mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 19:24:15 +00:00
Tested that TOML array can be converted to Java array
This commit is contained in:
parent
35c76d85a0
commit
6329f9cd62
3 changed files with 7 additions and 3 deletions
|
@ -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<String>(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);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,4 +20,5 @@ public class ExtraPrimitives {
|
|||
public URL url;
|
||||
public URI uri;
|
||||
public Set<String> set;
|
||||
public String[] strings;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue