/*
 * Copyright (c) 2012-2021 Snowflake Computing Inc. All rights reserved.
 */

package net.snowflake.client.jdbc.cloud.storage;

import static org.junit.Assert.assertEquals;

import com.microsoft.azure.storage.StorageExtendedErrorInformation;
import java.util.HashMap;
import org.junit.Test;

public class SnowflakeAzureClientTest {
  @Test
  public void testFormatStorageExtendedErrorInformation() {
    String expectedStr0 =
        "StorageExceptionExtendedErrorInformation: {ErrorCode= 403, ErrorMessage= Server refuses"
            + " to authorize the request, AdditionalDetails= {}}";
    String expectedStr1 =
        "StorageExceptionExtendedErrorInformation: {ErrorCode= 403, ErrorMessage= Server refuses"
            + " to authorize the request, AdditionalDetails= { key1= helloworld,key2= ,key3="
            + " fakemessage}}";
    StorageExtendedErrorInformation info = new StorageExtendedErrorInformation();
    info.setErrorCode("403");
    info.setErrorMessage("Server refuses to authorize the request");
    String formatedStr = SnowflakeAzureClient.FormatStorageExtendedErrorInformation(info);
    assertEquals(expectedStr0, formatedStr);

    HashMap<String, String[]> map = new HashMap<>();
    map.put("key1", new String[] {"hello", "world"});
    map.put("key2", new String[] {});
    map.put("key3", new String[] {"fake", "message"});
    info.setAdditionalDetails(map);
    formatedStr = SnowflakeAzureClient.FormatStorageExtendedErrorInformation(info);
    assertEquals(expectedStr1, formatedStr);
  }
}

@@ -255,16 +255,22 @@
 va.util.
+Linked
 HashMap;
@@ -1165,16 +1165,22 @@
 );%0A%0A    
+Linked
 HashMap%3C
@@ -1207,16 +1207,22 @@
 p = new 
+Linked
 HashMap%3C

Fix flakiness in SnowflakeAzureClientTest.java (#1164)