diff --git a/src/test/java/com/moandjiezana/toml/TomlToClassTest.java b/src/test/java/com/moandjiezana/toml/TomlToClassTest.java index ab1f605..d79dfd0 100644 --- a/src/test/java/com/moandjiezana/toml/TomlToClassTest.java +++ b/src/test/java/com/moandjiezana/toml/TomlToClassTest.java @@ -1,6 +1,9 @@ package com.moandjiezana.toml; +import static org.hamcrest.Matchers.arrayContaining; +import static org.hamcrest.Matchers.contains; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; @@ -9,9 +12,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; import java.net.URL; -import java.util.Arrays; import java.util.Calendar; -import java.util.HashSet; import java.util.TimeZone; import org.junit.Test; @@ -55,7 +56,8 @@ public class TomlToClassTest { assertEquals("Did not convert string to Character", Character.valueOf('u'), extraPrimitives.character); assertEquals("Did not convert string to URL", new URL("http://www.example.com").toString(), extraPrimitives.url.toString()); assertEquals("Did not convert string to URI", new URI("http://www.test.com").toString(), extraPrimitives.uri.toString()); - assertEquals("Did not convert list to Set", new HashSet(Arrays.asList("a", "b")), extraPrimitives.set); + assertThat(extraPrimitives.set, contains("a", "b")); + assertThat(extraPrimitives.strings, arrayContaining("c", "d")); assertEquals("Did not convert string to enum", ElementType.CONSTRUCTOR, extraPrimitives.elementType); } diff --git a/src/test/java/com/moandjiezana/toml/testutils/ExtraPrimitives.java b/src/test/java/com/moandjiezana/toml/testutils/ExtraPrimitives.java index b5d0ab9..a962f21 100644 --- a/src/test/java/com/moandjiezana/toml/testutils/ExtraPrimitives.java +++ b/src/test/java/com/moandjiezana/toml/testutils/ExtraPrimitives.java @@ -20,4 +20,5 @@ public class ExtraPrimitives { public URL url; public URI uri; public Set set; + public String[] strings; } diff --git a/src/test/resources/com/moandjiezana/toml/should_convert_extra_primitives.toml b/src/test/resources/com/moandjiezana/toml/should_convert_extra_primitives.toml index 359e027..98cb4cf 100644 --- a/src/test/resources/com/moandjiezana/toml/should_convert_extra_primitives.toml +++ b/src/test/resources/com/moandjiezana/toml/should_convert_extra_primitives.toml @@ -7,5 +7,6 @@ elementType="CONSTRUCTOR" url="http://www.example.com" uri="http://www.test.com" set=["a", "b"] +strings=["c", "d"] [group] key="value"