diff --git a/kotlin/tests/pom.xml b/kotlin/tests/pom.xml index 4c9c541..fef7548 100644 --- a/kotlin/tests/pom.xml +++ b/kotlin/tests/pom.xml @@ -108,7 +108,7 @@ src/test/kotlin src/test/java - target/generated-sources/kapt/test + target/generated-sources/kaptKotlin/test @@ -144,7 +144,9 @@ java-test-compile test-compile - testCompile + + testCompile + diff --git a/moshi/src/test/java/com/squareup/moshi/JsonValueWriterTest.java b/moshi/src/test/java/com/squareup/moshi/JsonValueWriterTest.java index a321104..7faae6f 100644 --- a/moshi/src/test/java/com/squareup/moshi/JsonValueWriterTest.java +++ b/moshi/src/test/java/com/squareup/moshi/JsonValueWriterTest.java @@ -18,6 +18,7 @@ package com.squareup.moshi; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.AbstractMap.SimpleEntry; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -28,7 +29,6 @@ import org.junit.Test; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; import static org.junit.Assert.fail; public final class JsonValueWriterTest { @@ -57,8 +57,11 @@ public final class JsonValueWriterTest { writer.name("d").nullValue(); writer.endObject(); - assertThat((Map) writer.root()).containsExactly( - entry("a", "s"), entry("b", 1.5d), entry("c", true), entry("d", null)); + assertThat((Map) writer.root()).containsExactly( + new SimpleEntry("a", "s"), + new SimpleEntry("b", 1.5d), + new SimpleEntry("c", true), + new SimpleEntry("d", null)); } @Test public void repeatedNameThrows() throws IOException { @@ -253,8 +256,11 @@ public final class JsonValueWriterTest { writer.name("d"); writer.value(new Buffer().writeUtf8("null")); writer.endObject(); - assertThat((Map) writer.root()).containsExactly( - entry("a", singletonList("value")), entry("b", 2.0d), entry("c", 3L), entry("d", null)); + assertThat((Map) writer.root()).containsExactly( + new SimpleEntry("a", singletonList("value")), + new SimpleEntry("b", 2.0d), + new SimpleEntry("c", 3L), + new SimpleEntry("d", null)); } /** diff --git a/moshi/src/test/java/com/squareup/moshi/MapJsonAdapterTest.java b/moshi/src/test/java/com/squareup/moshi/MapJsonAdapterTest.java index c967047..d368ce6 100644 --- a/moshi/src/test/java/com/squareup/moshi/MapJsonAdapterTest.java +++ b/moshi/src/test/java/com/squareup/moshi/MapJsonAdapterTest.java @@ -17,12 +17,12 @@ package com.squareup.moshi; import java.io.IOException; import java.lang.reflect.Type; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; import okio.Buffer; -import org.assertj.core.data.MapEntry; import org.junit.Test; import static com.squareup.moshi.TestUtil.newReader; @@ -45,7 +45,9 @@ public final class MapJsonAdapterTest { Map fromJson = fromJson( String.class, Boolean.class, "{\"a\":true,\"b\":false,\"c\":null}"); assertThat(fromJson).containsExactly( - MapEntry.entry("a", true), MapEntry.entry("b", false), MapEntry.entry("c", null)); + new SimpleEntry("a", true), + new SimpleEntry("b", false), + new SimpleEntry("c", null)); } @Test public void mapWithNullKeyFailsToEmit() throws Exception { @@ -119,13 +121,15 @@ public final class MapJsonAdapterTest { String toJson = toJson(Integer.class, Boolean.class, map); assertThat(toJson).isEqualTo("{\"5\":true,\"6\":false,\"7\":null}"); - Map fromJson = fromJson( + Map fromJson = fromJson( Integer.class, Boolean.class, "{\"5\":true,\"6\":false,\"7\":null}"); assertThat(fromJson).containsExactly( - MapEntry.entry(5, true), MapEntry.entry(6, false), MapEntry.entry(7, null)); + new SimpleEntry(5, true), + new SimpleEntry(6, false), + new SimpleEntry(7, null)); } - @Test public void mapWithNonStringKeysToJsonObject() throws Exception { + @Test public void mapWithNonStringKeysToJsonObject() { Map map = new LinkedHashMap<>(); map.put(5, true); map.put(6, false); diff --git a/moshi/src/test/java/com/squareup/moshi/ObjectAdapterTest.java b/moshi/src/test/java/com/squareup/moshi/ObjectAdapterTest.java index a844d94..72d2347 100644 --- a/moshi/src/test/java/com/squareup/moshi/ObjectAdapterTest.java +++ b/moshi/src/test/java/com/squareup/moshi/ObjectAdapterTest.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.AbstractCollection; import java.util.AbstractList; import java.util.AbstractMap; +import java.util.AbstractMap.SimpleEntry; import java.util.AbstractSet; import java.util.Arrays; import java.util.Collection; @@ -40,10 +41,9 @@ import org.junit.Test; import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; public final class ObjectAdapterTest { - @Test public void toJsonUsesRuntimeType() throws Exception { + @Test public void toJsonUsesRuntimeType() { Delivery delivery = new Delivery(); delivery.address = "1455 Market St."; Pizza pizza = new Pizza(); @@ -62,7 +62,7 @@ public final class ObjectAdapterTest { + "}"); } - @Test public void toJsonJavaLangObject() throws Exception { + @Test public void toJsonJavaLangObject() { Moshi moshi = new Moshi.Builder().build(); JsonAdapter adapter = moshi.adapter(Object.class); assertThat(adapter.toJson(new Object())).isEqualTo("{}"); @@ -104,7 +104,7 @@ public final class ObjectAdapterTest { .isEqualTo(emptyDelivery); } - @Test public void toJsonCoercesRuntimeTypeForCollections() throws Exception { + @Test public void toJsonCoercesRuntimeTypeForCollections() { Collection collection = new AbstractCollection() { @Override public Iterator iterator() { return Collections.singleton("A").iterator(); @@ -119,7 +119,7 @@ public final class ObjectAdapterTest { assertThat(adapter.toJson(collection)).isEqualTo("[\"A\"]"); } - @Test public void toJsonCoercesRuntimeTypeForLists() throws Exception { + @Test public void toJsonCoercesRuntimeTypeForLists() { List list = new AbstractList() { @Override public String get(int i) { return "A"; @@ -135,7 +135,7 @@ public final class ObjectAdapterTest { assertThat(adapter.toJson(list)).isEqualTo("[\"A\"]"); } - @Test public void toJsonCoercesRuntimeTypeForSets() throws Exception { + @Test public void toJsonCoercesRuntimeTypeForSets() { Set set = new AbstractSet() { @Override public Iterator iterator() { return Collections.singleton("A").iterator(); @@ -151,7 +151,7 @@ public final class ObjectAdapterTest { } @Ignore // We don't support raw maps, like Map. (Even if the keys are strings!) - @Test public void toJsonCoercesRuntimeTypeForMaps() throws Exception { + @Test public void toJsonCoercesRuntimeTypeForMaps() { Map map = new AbstractMap() { @Override public Set> entrySet() { return Collections.singletonMap("A", true).entrySet(); @@ -163,7 +163,7 @@ public final class ObjectAdapterTest { assertThat(adapter.toJson(map)).isEqualTo("{\"A\":true}"); } - @Test public void toJsonUsesTypeAdapters() throws Exception { + @Test public void toJsonUsesTypeAdapters() { Object dateAdapter = new Object() { @ToJson Long dateToJson(Date d) { return d.getTime(); @@ -185,7 +185,7 @@ public final class ObjectAdapterTest { */ @Test public void objectAdapterDelegatesStringNamesAndValues() throws Exception { JsonAdapter stringAdapter = new JsonAdapter() { - @Nullable @Override public String fromJson(JsonReader reader) throws IOException { + @Override public String fromJson(JsonReader reader) throws IOException { return reader.nextString().toUpperCase(Locale.US); } @@ -198,8 +198,9 @@ public final class ObjectAdapterTest { .add(String.class, stringAdapter) .build(); JsonAdapter objectAdapter = moshi.adapter(Object.class); - Map value = (Map) objectAdapter.fromJson("{\"a\":\"b\", \"c\":\"d\"}"); - assertThat(value).containsExactly(entry("A", "B"), entry("C", "D")); + Map value + = (Map) objectAdapter.fromJson("{\"a\":\"b\", \"c\":\"d\"}"); + assertThat(value).containsExactly(new SimpleEntry<>("A", "B"), new SimpleEntry<>("C", "D")); } /** @@ -241,7 +242,7 @@ public final class ObjectAdapterTest { /** Confirm that the built-in adapter for Object delegates to user-supplied adapters for lists. */ @Test public void objectAdapterDelegatesLists() throws Exception { JsonAdapter> listAdapter = new JsonAdapter>() { - @Override public @Nullable List fromJson(JsonReader reader) throws IOException { + @Override public List fromJson(JsonReader reader) throws IOException { reader.skipValue(); return singletonList("z"); } @@ -262,7 +263,7 @@ public final class ObjectAdapterTest { /** Confirm that the built-in adapter for Object delegates to user-supplied adapters for maps. */ @Test public void objectAdapterDelegatesMaps() throws Exception { JsonAdapter> mapAdapter = new JsonAdapter>() { - @Override public @Nullable Map fromJson(JsonReader reader) throws IOException { + @Override public Map fromJson(JsonReader reader) throws IOException { reader.skipValue(); return singletonMap("x", "y"); } diff --git a/pom.xml b/pom.xml index db6ad7b..54d5fb8 100644 --- a/pom.xml +++ b/pom.xml @@ -29,8 +29,8 @@ UTF-8 1.7 - 1.2.21 - 1.3.0 + 1.2.71 + 1.4.0 0.9.17 3.1.0 @@ -38,9 +38,9 @@ 1.15.0 - 0.8 + 0.15 4.12 - 1.7.0 + 3.11.1