Skip to content

Commit

Permalink
#6276 add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rogin committed Sep 10, 2024
1 parent 8bd7c2f commit 30d2760
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core-util/test/com/mirth/connect/util/HttpUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@

package com.mirth.connect.util;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;

import java.security.KeyStore;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;

import javax.net.ssl.SSLContext;
Expand All @@ -22,6 +25,9 @@
import org.apache.http.ssl.SSLContexts;
import org.junit.Test;

import com.mirth.connect.donkey.model.message.ConnectorMessage;
import com.mirth.connect.donkey.util.MessageMaps;

public class HttpUtilTest {

@Test
Expand All @@ -40,4 +46,20 @@ public void testExecuteGetRequest() throws Exception {
} catch (Exception e) {
}
}

@Test
public void testMapOrderPreserved() {
final String MAP_KEY = "MyMap";

Map<String, Object> initial = new LinkedHashMap<>();
initial.put("First", 1);
initial.put("Second", 2);
initial.put("Third", 3);

ConnectorMessage cm = new ConnectorMessage();
cm.getSourceMap().put(MAP_KEY, initial);

Map<?, ?> copied = HttpUtil.getTableMap(MAP_KEY, new MessageMaps(), cm);
assertArrayEquals("Failed to preserve key order", initial.keySet().toArray(), copied.keySet().toArray());
}
}

0 comments on commit 30d2760

Please sign in to comment.