use of com.tvd12.ezyhttp.core.data.MultiValueMap in project ezyhttp by youngmonkeys.
the class MultiValueMapTest method getValueMapTest.
@Test
public void getValueMapTest() {
// given
Map<String, Object> values = new HashMap<>();
values.put("a", null);
values.put("b", "");
values.put("c", 100);
values.put("d", "good");
values.put("e", true);
MultiValueMap sut = MultiValueMap.builder().setValue("1", "hello").setValues("2", Arrays.asList("foo", "bar")).setValues("3", Collections.emptyList()).setValues("m", values).setValue("z", "").build();
// when
Map<String, String> actual1 = sut.getValueMap("m");
Map<String, String> actual2 = sut.getValueMap("1");
Map<String, String> actual3 = sut.getValueMap("2");
Map<String, String> actual4 = sut.getValueMap("z");
// then
Map<String, Object> expectation1 = new HashMap<>();
expectation1.put("a", null);
expectation1.put("b", "");
expectation1.put("c", "100");
expectation1.put("d", "good");
expectation1.put("e", "true");
Asserts.assertEquals(actual1, expectation1);
Map<String, String> expectation2 = new HashMap<>();
expectation2.put("hello", null);
Asserts.assertEquals(actual2, expectation2);
Map<String, String> expectation3 = new HashMap<>();
expectation3.put("foo", null);
expectation3.put("bar", null);
Asserts.assertEquals(actual3, expectation3);
Asserts.assertEquals(new HashMap<>(), actual4);
}
Aggregations