diff --git a/src/main/java/com/moandjiezana/toml/ArrayValueWriter.java b/src/main/java/com/moandjiezana/toml/ArrayValueWriter.java index 2e51d28..c5de0c5 100644 --- a/src/main/java/com/moandjiezana/toml/ArrayValueWriter.java +++ b/src/main/java/com/moandjiezana/toml/ArrayValueWriter.java @@ -1,12 +1,12 @@ package com.moandjiezana.toml; -import static com.moandjiezana.toml.ValueWriters.WRITERS; - import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; +import static com.moandjiezana.toml.ValueWriters.WRITERS; + abstract class ArrayValueWriter implements ValueWriter { static protected boolean isArrayish(Object value) { return value instanceof Collection || value.getClass().isArray(); @@ -24,7 +24,7 @@ abstract class ArrayValueWriter implements ValueWriter { return valueWriter.isPrimitiveType() || isArrayish(first); } - return false; + return true; } @SuppressWarnings("unchecked") diff --git a/src/test/java/com/moandjiezana/toml/BurntSushiValidEncoderTest.java b/src/test/java/com/moandjiezana/toml/BurntSushiValidEncoderTest.java index b4d2997..456ae8f 100644 --- a/src/test/java/com/moandjiezana/toml/BurntSushiValidEncoderTest.java +++ b/src/test/java/com/moandjiezana/toml/BurntSushiValidEncoderTest.java @@ -1,6 +1,10 @@ package com.moandjiezana.toml; -import static org.junit.Assert.assertEquals; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import org.junit.*; import java.io.InputStream; import java.io.InputStreamReader; @@ -15,15 +19,15 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import org.junit.Test; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import static org.junit.Assert.*; public class BurntSushiValidEncoderTest { + @Test + public void array_empty() throws Exception { + runEncoder("array-empty"); + } + @Test public void arrays_hetergeneous() throws Exception { runEncoder("arrays-hetergeneous"); diff --git a/src/test/java/com/moandjiezana/toml/TomlWriterTest.java b/src/test/java/com/moandjiezana/toml/TomlWriterTest.java index cbca1f8..4ec2642 100644 --- a/src/test/java/com/moandjiezana/toml/TomlWriterTest.java +++ b/src/test/java/com/moandjiezana/toml/TomlWriterTest.java @@ -1,6 +1,8 @@ package com.moandjiezana.toml; -import static org.junit.Assert.assertEquals; +import org.hamcrest.Matchers; +import org.junit.*; +import org.junit.rules.*; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; @@ -23,11 +25,7 @@ import java.util.List; import java.util.Map; import java.util.TimeZone; -import org.hamcrest.Matchers; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TemporaryFolder; +import static org.junit.Assert.*; @SuppressWarnings("unused") public class TomlWriterTest { @@ -219,7 +217,7 @@ public class TomlWriterTest { List aList = new LinkedList(); Float[] anArray = new Float[0]; } - assertEquals("", new TomlWriter().write(new TestClass())); + assertEquals("aList = []\nanArray = []\n", new TomlWriter().write(new TestClass())); } @Test