Files
java-tutorials/java-collections-maps/src/test/java/com/baeldung/convert/StringToMapUnitTest.java
T
Laurentiu Delcea b8dbc9d053 BAEL-2480 Java Map to String conversion (#6075)
* BAEL-2480 Java Map to String conversion

* BAEL-2480 Java Map to String conversion

* BAEL-2480 Java Map to String conversion

* BAEL-2480 Java Map to String conversion
2019-01-10 13:21:06 -08:00

23 lines
750 B
Java

package com.baeldung.convert;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import java.util.Map;
public class StringToMapUnitTest {
@Test
public void givenString_WhenUsingStream_ThenResultingStringIsCorrect() {
Map<String, String> wordsByKey = StringToMap.convertWithStream("1=one,2=two,3=three,4=four");
Assert.assertEquals(4, wordsByKey.size());
Assert.assertEquals("one", wordsByKey.get("1"));
}
@Test
void givenString_WhenUsingGuava_ThenResultingStringIsCorrect() {
Map<String, String> wordsByKey = StringToMap.convertWithGuava("1=one,2=two,3=three,4=four");
Assert.assertEquals(4, wordsByKey.size());
Assert.assertEquals("one", wordsByKey.get("1"));
}
}