diff --git a/avro/pom.xml b/avro/pom.xml index aa8c01a02..341ccd49b 100644 --- a/avro/pom.xml +++ b/avro/pom.xml @@ -54,7 +54,7 @@ abstractions. ch.qos.logback logback-classic - 1.2.11 + 1.2.12 test diff --git a/ion/README.md b/ion/README.md index d719095a2..db4460c4c 100644 --- a/ion/README.md +++ b/ion/README.md @@ -34,9 +34,9 @@ SomeType otherValue = mapper.readValue(data, SomeType.class); ### java.time JSR 310 -With version 2.12 (to be released in September 2020), there will be optional support for +Version 2.12 (released on November 28, 2020) added support for (de)serializing some `java.time` classes directly from/to Ion timestamp values. -To enable it, you need to registed module `IonJavaTimeModule` like so: +To enable it, you need to register module `IonJavaTimeModule` like so: ```java IonObjectMapper mapper = IonObjectMapper.builder() diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializer.java index 7eef0c2a7..e767480d3 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializer.java @@ -86,7 +86,7 @@ public ValueDeserializer createContextual(DeserializationContext ctxt, BeanPr final JsonFormat.Value format = findFormatOverrides(ctxt, property, handledType()); if (format != null) { - return new IonTimestampInstantDeserializer(this, + return new IonTimestampInstantDeserializer<>(this, format.getFeature(Feature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)); } return this; diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/DataBindRoundtripTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/DataBindRoundtripTest.java index d9e8ee68f..849b2a93a 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/DataBindRoundtripTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/DataBindRoundtripTest.java @@ -174,9 +174,9 @@ public void testIonRoot() throws IOException { Bean bean = m.readValue(root, Bean.class); assertNotNull(bean); assertEquals(bean.a, "test"); - assertTrue(bean.b == 0.25); + assertEquals(0.25, bean.b, 0.0); assertArrayEquals(new byte[0], bean.data); - assertEquals(bean.state, true); + assertTrue(bean.state); assertNotNull(bean.sub); assertEquals("yellow", bean.sub.getValue()); assertEquals("testSymbol", bean.symbol); @@ -217,7 +217,7 @@ private void _testRoundTrip(Bean bean, RoundTrippers rt, IonObjectMapper m) thro assertNotNull(result); assertEquals(bean.a, result.a); - assertTrue(bean.b == result.b); + assertEquals(bean.b, result.b, 0.0); assertArrayEquals(bean.data, result.data); assertEquals(bean.state, result.state); if (bean.sub == null) @@ -233,6 +233,6 @@ private void _testRoundTrip(Bean bean, RoundTrippers rt, IonObjectMapper m) thro assertEquals(bean.enumVal, result.enumVal); assertEquals(bean.bigDec, result.bigDec); assertEquals(bean.bigInt, result.bigInt); - assertTrue(bean.f == result.f); + assertEquals(bean.f, result.f, 0.0); } } diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/IonGeneratorTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/IonGeneratorTest.java index e9495f0ba..b383f725b 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/IonGeneratorTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/IonGeneratorTest.java @@ -45,7 +45,7 @@ public class IonGeneratorTest { "}"; static { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("a", "A"); map.put("b", "B"); map.put("c", "C"); @@ -77,7 +77,7 @@ public void setUp() throws Exception { @Test public void testSimpleWrite() throws Exception { joiGenerator.writeBoolean(true); - assertThat(output.get(0), is((IonValue)ionSystem.newBool(true))); + assertThat(output.get(0), is(ionSystem.newBool(true))); } @Test diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/IonParserTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/IonParserTest.java index 1cf42eb3a..8b3d87214 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/IonParserTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/IonParserTest.java @@ -70,7 +70,7 @@ public void testGetNumberTypeAndValue() throws Exception { IonParser decimalParser = ionFactory.createParser(EMPTY_READ_CTXT, ionDecimal); Assert.assertEquals(JsonToken.VALUE_NUMBER_FLOAT, decimalParser.nextToken()); Assert.assertEquals(JsonParser.NumberType.BIG_DECIMAL, decimalParser.getNumberType()); - Assert.assertTrue(new BigDecimal("" + decimalValue).compareTo((BigDecimal)decimalParser.getNumberValue()) == 0); + Assert.assertEquals(0, new BigDecimal("" + decimalValue).compareTo((BigDecimal) decimalParser.getNumberValue())); Double floatValue = Double.MAX_VALUE; IonValue ionFloat = ion.newFloat(floatValue); @@ -84,7 +84,7 @@ public void testGetNumberTypeAndValue() throws Exception { IonParser bigDecimalParser = ionFactory.createParser(EMPTY_READ_CTXT, ionBigDecimal); Assert.assertEquals(JsonToken.VALUE_NUMBER_FLOAT, bigDecimalParser.nextToken()); Assert.assertEquals(JsonParser.NumberType.BIG_DECIMAL, bigDecimalParser.getNumberType()); - Assert.assertTrue(bigDecimalValue.compareTo((BigDecimal)bigDecimalParser.getNumberValue()) == 0); + Assert.assertEquals(0, bigDecimalValue.compareTo((BigDecimal) bigDecimalParser.getNumberValue())); } @Test diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/SimpleIonWriteTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/SimpleIonWriteTest.java index 198979f87..47f9ffe01 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/SimpleIonWriteTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/SimpleIonWriteTest.java @@ -81,7 +81,7 @@ private void _writeSimple(JsonGenerator gen) throws IOException gen.writeStartObject(); gen.writeStringProperty("a", "value"); gen.writeNumberProperty("b", 42); - ((IonGenerator)gen).writeName("c"); + gen.writeName("c"); ((IonGenerator)gen).writeNull(IonType.INT); gen.writeEndObject(); gen.close(); diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/failing/PolymorphicRoundtripTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/failing/PolymorphicRoundtripTest.java index 88a8f4b7d..e73b09344 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/failing/PolymorphicRoundtripTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/failing/PolymorphicRoundtripTest.java @@ -249,14 +249,14 @@ public void testSelectivePolymorphism() throws IOException { // to be chosen (and we expect that first id to be the most narrow type, ChildBeanSub). Bean deserialized = mapper.readValue(serialized, Bean.class); - assertTrue(deserialized.child.getClass().equals(ChildBeanSub.class)); + assertEquals(deserialized.child.getClass(), ChildBeanSub.class); assertEquals(((ChildBeanSub) original.child).extraField, ((ChildBeanSub) deserialized.child).extraField); // second, try deserializing with the wider type (ChildBean). We're losing data (extraField) preferredTypeId = getClass().getCanonicalName() + "$ChildBean"; deserialized = mapper.readValue(serialized, Bean.class); - assertTrue(deserialized.child.getClass().equals(ChildBean.class)); + assertEquals(deserialized.child.getClass(), ChildBean.class); assertEquals(original.child.someField, deserialized.child.someField); // third, try deserializing into an Object. The child node should deserialize, but immediately fail mapping. @@ -445,7 +445,7 @@ class MultipleClassNameIdResolver extends ClassNameIdResolver implements Multipl @Override public String[] idsFromValue(Object value) { - List ids = new ArrayList(); + List ids = new ArrayList<>(); Class cls = value.getClass(); while (null != cls) { ids.add(super.idFromValueAndType(value, cls)); diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/failing/UncaughtException303Test.java b/ion/src/test/java/tools/jackson/dataformat/ion/failing/UncaughtException303Test.java index b6f2ac496..bac953835 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/failing/UncaughtException303Test.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/failing/UncaughtException303Test.java @@ -31,7 +31,7 @@ void verifyException(Throwable e, String match) { String msg = e.getMessage(); String lmsg = (msg == null) ? "" : msg.toLowerCase(); - if (lmsg.indexOf(match.toLowerCase()) < 0) { + if (!lmsg.contains(match.toLowerCase())) { fail("Expected an exception with a substrings ("+match+"): got one with message \""+msg+"\""); } } diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueDeserializerTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueDeserializerTest.java index 8070d5393..e0b3c333d 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueDeserializerTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueDeserializerTest.java @@ -23,6 +23,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class IonValueDeserializerTest { private static class Data { @@ -208,7 +209,7 @@ public void testWithMissingProperty() throws IOException String input2 = "{required:{}}"; MyBean deserializedBean2 = ionObjectMapper.readValue(input2, MyBean.class); assertEquals(ionSystem.newEmptyStruct(), deserializedBean2.required); - assertEquals(null, deserializedBean2.optional); + assertNull(deserializedBean2.optional); } @Test diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueMapperTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueMapperTest.java index 23c87a624..e18b65d9c 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueMapperTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/ionvalue/IonValueMapperTest.java @@ -20,6 +20,7 @@ import java.util.Map; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -138,7 +139,7 @@ public void testPojo1() throws Exception { TestPojo1 t = ionValueMapper.readValue(ionSystem.singleValue(value), TestPojo1.class); assertEquals("yes", t.myString); assertEquals("yes", t.mySymbol); - assertEquals(false, t.doesThisWork); + assertFalse(t.doesThisWork); assertEquals(5, t.iHaveSomeOtherName); assertEquals(ReturnCode.Success, t.imAnEnum); assertEquals(Timestamp.valueOf("2010-01-01T06:00:00Z"), t.someTime); diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java index 30a5eeb06..3b205dc28 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java @@ -34,7 +34,7 @@ void verifyException(Throwable e, String match) { String msg = e.getMessage(); String lmsg = (msg == null) ? "" : msg.toLowerCase(); - if (lmsg.indexOf(match.toLowerCase()) < 0) { + if (!lmsg.contains(match.toLowerCase())) { fail("Expected an exception with a substrings ("+match+"): got one with message \""+msg+"\""); } } diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/polymorphism/SerializationAnnotationsTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/polymorphism/SerializationAnnotationsTest.java index 0028805d2..9a999546f 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/polymorphism/SerializationAnnotationsTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/polymorphism/SerializationAnnotationsTest.java @@ -112,8 +112,8 @@ private static void assertCorrectlyTypedAndFormed(final Subclass expectedSubclas assertEquals(expectedSubclass, (Subclass) actualBaseclass); } private static void assertEquals(Subclass expected, Subclass actual) { - Assert.assertEquals(expected.someString, ((Subclass) actual).someString); - Assert.assertEquals(expected.anInt, ((Subclass) actual).anInt); + Assert.assertEquals(expected.someString, actual.someString); + Assert.assertEquals(expected.anInt, actual.anInt); } private static void assertEqualIonValues(IonValue expected, IonValue actual) {