diff --git a/pom.xml b/pom.xml index 5933a60d..039af9fc 100644 --- a/pom.xml +++ b/pom.xml @@ -54,11 +54,11 @@ - - junit - junit - ${version.junit} - test + + org.junit.jupiter + junit-jupiter + 5.9.1 + test diff --git a/src/test/java/com/fasterxml/jackson/annotation/FormatTest.java b/src/test/java/com/fasterxml/jackson/annotation/FormatTest.java index 8ed17308..68cb4f07 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/FormatTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/FormatTest.java @@ -3,17 +3,22 @@ import com.fasterxml.jackson.annotation.JsonFormat.Feature; import com.fasterxml.jackson.annotation.JsonFormat.Shape; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + /** * Tests to verify that it is possibly to merge {@link JsonFormat.Value} * instances for overrides. */ -public class FormatTest extends TestBase +public class FormatTest { private final JsonFormat.Value EMPTY = JsonFormat.Value.empty(); @JsonFormat(shape=JsonFormat.Shape.BOOLEAN, pattern="xyz", timezone="bogus") private final static class Bogus { } + @Test public void testEmptyInstanceDefaults() { JsonFormat.Value empty = JsonFormat.Value.empty(); for (Feature f : Feature.values()) { @@ -28,6 +33,7 @@ public void testEmptyInstanceDefaults() { assertFalse(empty.isLenient()); } + @Test public void testEquality() { assertTrue(EMPTY.equals(EMPTY)); assertTrue(new JsonFormat.Value().equals(new JsonFormat.Value())); @@ -54,6 +60,7 @@ public void testEquality() { assertFalse(v1.equals(v1.withoutFeature(Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))); } + @Test public void testToString() { assertEquals("JsonFormat.Value(pattern=,shape=STRING,lenient=null,locale=null,timezone=null,features=EMPTY)", JsonFormat.Value.forShape(JsonFormat.Shape.STRING).toString()); @@ -61,6 +68,7 @@ public void testToString() { JsonFormat.Value.forPattern("[.]").toString()); } + @Test public void testFromAnnotation() { JsonFormat ann = Bogus.class.getAnnotation(JsonFormat.class); @@ -74,6 +82,7 @@ public void testFromAnnotation() assertSame(EMPTY, JsonFormat.Value.from(null)); } + @Test public void testSimpleMerge() { // Start with an empty instance @@ -131,6 +140,7 @@ public void testSimpleMerge() assertFalse(merged.hasTimeZone()); } + @Test public void testMultiMerge() { final String TEST_PATTERN = "format-string"; // not parsed, usage varies @@ -148,6 +158,7 @@ public void testMultiMerge() /********************************************************** */ + @Test public void testLeniency() { JsonFormat.Value empty = JsonFormat.Value.empty(); assertFalse(empty.hasLenient()); @@ -186,6 +197,7 @@ public void testLeniency() { assertFalse(dunno.equals(lenient)); } + @Test public void testCaseInsensitiveValues() { JsonFormat.Value empty = JsonFormat.Value.empty(); assertNull(empty.getFeature(Feature.ACCEPT_CASE_INSENSITIVE_VALUES)); @@ -197,6 +209,7 @@ public void testCaseInsensitiveValues() { assertFalse(sensitive.getFeature(Feature.ACCEPT_CASE_INSENSITIVE_VALUES)); } + @Test public void testShape() { assertFalse(JsonFormat.Shape.STRING.isNumeric()); assertFalse(JsonFormat.Shape.STRING.isStructured()); @@ -209,6 +222,7 @@ public void testShape() { assertTrue(JsonFormat.Shape.OBJECT.isStructured()); } + @Test public void testFeatures() { JsonFormat.Features f1 = JsonFormat.Features.empty(); JsonFormat.Features f2 = f1.with(Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) diff --git a/src/test/java/com/fasterxml/jackson/annotation/IncludeTest.java b/src/test/java/com/fasterxml/jackson/annotation/IncludeTest.java index d7183bef..bdb015e1 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/IncludeTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/IncludeTest.java @@ -2,11 +2,15 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + /** * Tests to verify that it is possibly to merge {@link JsonInclude.Value} * instances for overrides */ -public class IncludeTest extends TestBase +public class IncludeTest { private final JsonInclude.Value EMPTY = JsonInclude.Value.empty(); @@ -17,6 +21,7 @@ private final static class Bogus { } content=JsonInclude.Include.CUSTOM, contentFilter=Long.class) private final static class Custom { } + @Test public void testEquality() { assertTrue(EMPTY.equals(EMPTY)); @@ -33,6 +38,7 @@ public void testEquality() { assertFalse(v3.equals(v2)); } + @Test public void testFromAnnotation() { JsonInclude ann = Bogus.class.getAnnotation(JsonInclude.class); @@ -41,6 +47,7 @@ public void testFromAnnotation() assertEquals(Include.NON_DEFAULT, v.getContentInclusion()); } + @Test public void testFromAnnotationWithCustom() { JsonInclude ann = Custom.class.getAnnotation(JsonInclude.class); @@ -55,6 +62,7 @@ public void testFromAnnotationWithCustom() v.toString()); } + @Test public void testStdOverrides() { assertEquals("JsonInclude.Value(value=NON_ABSENT,content=USE_DEFAULTS)", JsonInclude.Value.construct(Include.NON_ABSENT, null).toString()); @@ -66,6 +74,7 @@ public void testStdOverrides() { assertFalse(EMPTY.equals("")); } + @Test public void testSimpleMerge() { JsonInclude.Value empty = JsonInclude.Value.empty(); @@ -100,6 +109,7 @@ public void testSimpleMerge() } // for [annotations#76] + @Test public void testContentMerge76() { JsonInclude.Value v1 = JsonInclude.Value.empty() @@ -119,6 +129,7 @@ public void testContentMerge76() assertEquals(JsonInclude.Include.NON_ABSENT, v21.getValueInclusion()); } + @Test public void testFilters() { JsonInclude.Value empty = JsonInclude.Value.empty(); diff --git a/src/test/java/com/fasterxml/jackson/annotation/JacksonInjectTest.java b/src/test/java/com/fasterxml/jackson/annotation/JacksonInjectTest.java index 18dc6553..3028d97c 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/JacksonInjectTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/JacksonInjectTest.java @@ -1,6 +1,10 @@ package com.fasterxml.jackson.annotation; -public class JacksonInjectTest extends TestBase +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class JacksonInjectTest { private final static class Bogus { @JacksonInject(value="inject", useInput=OptBoolean.FALSE) @@ -12,6 +16,7 @@ private final static class Bogus { private final JacksonInject.Value EMPTY = JacksonInject.Value.empty(); + @Test public void testEmpty() { assertNull(EMPTY.getId()); @@ -24,6 +29,7 @@ public void testEmpty() assertSame(EMPTY, JacksonInject.Value.construct("", null)); } + @Test public void testFromAnnotation() throws Exception { assertSame(EMPTY, JacksonInject.Value.from(null)); // legal @@ -42,6 +48,7 @@ public void testFromAnnotation() throws Exception assertSame(EMPTY, v); } + @Test public void testStdMethods() { assertEquals("JacksonInject.Value(id=null,useInput=null)", EMPTY.toString()); @@ -54,6 +61,7 @@ public void testStdMethods() { assertFalse(EMPTY.equals("xyz")); } + @Test public void testFactories() throws Exception { JacksonInject.Value v = EMPTY.withId("name"); diff --git a/src/test/java/com/fasterxml/jackson/annotation/JsonIgnorePropertiesTest.java b/src/test/java/com/fasterxml/jackson/annotation/JsonIgnorePropertiesTest.java index 14f1a9c1..4a1a7992 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/JsonIgnorePropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/JsonIgnorePropertiesTest.java @@ -2,11 +2,15 @@ import java.util.*; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + /** * Tests to verify that it is possibly to merge {@link JsonIgnoreProperties.Value} * instances for overrides */ -public class JsonIgnorePropertiesTest extends TestBase +public class JsonIgnorePropertiesTest { @JsonIgnoreProperties(value={ "foo", "bar" }, ignoreUnknown=true) private final static class Bogus { @@ -14,6 +18,7 @@ private final static class Bogus { private final JsonIgnoreProperties.Value EMPTY = JsonIgnoreProperties.Value.empty(); + @Test public void testEmpty() { // ok to try to create from null; gives empty assertSame(EMPTY, JsonIgnoreProperties.Value.from(null)); @@ -23,6 +28,7 @@ public void testEmpty() { assertFalse(EMPTY.getAllowSetters()); } + @Test public void testEquality() { assertEquals(EMPTY, EMPTY); @@ -35,6 +41,7 @@ public void testEquality() { assertFalse(v.equals(EMPTY)); } + @Test public void testFromAnnotation() throws Exception { JsonIgnoreProperties.Value v = JsonIgnoreProperties.Value.from( @@ -48,6 +55,7 @@ public void testFromAnnotation() throws Exception assertEquals(_set("foo", "bar"), ign); } + @Test public void testFactories() { assertSame(EMPTY, JsonIgnoreProperties.Value.forIgnoreUnknown(false)); assertSame(EMPTY, JsonIgnoreProperties.Value.forIgnoredProperties()); @@ -71,6 +79,7 @@ public void testFactories() { assertEquals(_set("a", "b"), vdeser.findIgnoredForSerialization()); } + @Test public void testMutantFactories() { assertEquals(2, EMPTY.withIgnored("a", "b").getIgnored().size()); @@ -89,6 +98,7 @@ public void testMutantFactories() assertFalse(EMPTY.withoutMerge().getMerge()); } + @Test public void testSimpleMerge() { JsonIgnoreProperties.Value v1 = EMPTY.withIgnoreUnknown().withAllowGetters(); @@ -117,6 +127,7 @@ public void testSimpleMerge() assertSame(v2b, v2b.withOverrides(EMPTY)); } + @Test public void testMergeIgnoreProperties() { JsonIgnoreProperties.Value v1 = EMPTY.withIgnored("a"); @@ -131,6 +142,7 @@ public void testMergeIgnoreProperties() assertTrue(all.contains("c")); } + @Test public void testToString() { assertEquals( "JsonIgnoreProperties.Value(ignored=[],ignoreUnknown=false,allowGetters=false,allowSetters=true,merge=true)", diff --git a/src/test/java/com/fasterxml/jackson/annotation/JsonIncludePropertiesTest.java b/src/test/java/com/fasterxml/jackson/annotation/JsonIncludePropertiesTest.java index 2b83c719..c751d4d6 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/JsonIncludePropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/JsonIncludePropertiesTest.java @@ -1,15 +1,16 @@ package com.fasterxml.jackson.annotation; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.Set; +import java.util.*; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; /** * Tests to verify that it is possibly to merge {@link JsonIncludeProperties.Value} * instances for overrides */ -public class JsonIncludePropertiesTest extends TestBase +public class JsonIncludePropertiesTest { @JsonIncludeProperties(value = {"foo", "bar"}) private final static class Bogus @@ -18,6 +19,7 @@ private final static class Bogus private final JsonIncludeProperties.Value ALL = JsonIncludeProperties.Value.all(); + @Test public void testAll() { assertSame(ALL, JsonIncludeProperties.Value.from(null)); @@ -27,6 +29,7 @@ public void testAll() assertEquals(0, ALL.hashCode()); } + @Test public void testFromAnnotation() { JsonIncludeProperties.Value v = JsonIncludeProperties.Value.from(Bogus.class.getAnnotation(JsonIncludeProperties.class)); @@ -41,6 +44,7 @@ public void testFromAnnotation() assertEquals(v, JsonIncludeProperties.Value.from(Bogus.class.getAnnotation(JsonIncludeProperties.class))); } + @Test public void testWithOverridesAll() { JsonIncludeProperties.Value v = JsonIncludeProperties.Value.from(Bogus.class.getAnnotation(JsonIncludeProperties.class)); v = v.withOverrides(ALL); @@ -49,6 +53,7 @@ public void testWithOverridesAll() { assertEquals(_set("foo", "bar"), included); } + @Test public void testWithOverridesEmpty() { JsonIncludeProperties.Value v = JsonIncludeProperties.Value.from(Bogus.class.getAnnotation(JsonIncludeProperties.class)); v = v.withOverrides(new JsonIncludeProperties.Value(Collections.emptySet())); @@ -56,6 +61,7 @@ public void testWithOverridesEmpty() { assertEquals(0, included.size()); } + @Test public void testWithOverridesMerge() { JsonIncludeProperties.Value v = JsonIncludeProperties.Value.from(Bogus.class.getAnnotation(JsonIncludeProperties.class)); v = v.withOverrides(new JsonIncludeProperties.Value(_set("foo"))); diff --git a/src/test/java/com/fasterxml/jackson/annotation/JsonSetterTest.java b/src/test/java/com/fasterxml/jackson/annotation/JsonSetterTest.java index 209e8469..2932c0be 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/JsonSetterTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/JsonSetterTest.java @@ -1,6 +1,10 @@ package com.fasterxml.jackson.annotation; -public class JsonSetterTest extends TestBase +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class JsonSetterTest { private final static class Bogus { @JsonSetter(nulls=Nulls.FAIL, contentNulls=Nulls.SKIP) @@ -9,6 +13,7 @@ private final static class Bogus { private final JsonSetter.Value EMPTY = JsonSetter.Value.empty(); + @Test public void testEmpty() { assertEquals(Nulls.DEFAULT, EMPTY.getValueNulls()); @@ -20,6 +25,7 @@ public void testEmpty() assertNull(EMPTY.nonDefaultContentNulls()); } + @Test public void testStdMethods() { assertEquals("JsonSetter.Value(valueNulls=DEFAULT,contentNulls=DEFAULT)", EMPTY.toString()); @@ -32,6 +38,7 @@ public void testStdMethods() { assertFalse(EMPTY.equals("xyz")); } + @Test public void testFromAnnotation() throws Exception { assertSame(EMPTY, JsonSetter.Value.from(null)); // legal @@ -42,12 +49,14 @@ public void testFromAnnotation() throws Exception assertEquals(Nulls.SKIP, v.getContentNulls()); } + @Test public void testConstruct() throws Exception { JsonSetter.Value v = JsonSetter.Value.construct(null, null); assertSame(EMPTY, v); } + @Test public void testFactories() throws Exception { JsonSetter.Value v = JsonSetter.Value.forContentNulls(Nulls.SET); @@ -61,6 +70,7 @@ public void testFactories() throws Exception assertEquals(Nulls.SKIP, skip.nonDefaultValueNulls()); } + @Test public void testSimpleMerge() { JsonSetter.Value v = EMPTY.withContentNulls(Nulls.SKIP); @@ -69,6 +79,7 @@ public void testSimpleMerge() assertEquals(Nulls.FAIL, v.getValueNulls()); } + @Test public void testWithMethods() { JsonSetter.Value v = EMPTY.withContentNulls(null); diff --git a/src/test/java/com/fasterxml/jackson/annotation/JsonTypeInfoTest.java b/src/test/java/com/fasterxml/jackson/annotation/JsonTypeInfoTest.java index 52e67848..247ad45e 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/JsonTypeInfoTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/JsonTypeInfoTest.java @@ -2,7 +2,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo.As; -public class JsonTypeInfoTest extends TestBase +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class JsonTypeInfoTest { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, visible=true, defaultImpl = JsonTypeInfo.class, requireTypeIdForSubtypes = OptBoolean.TRUE) @@ -17,12 +21,14 @@ private final static class Anno2 { } property = "ext", defaultImpl = Void.class) private final static class Anno3 { } - + + @Test public void testEmpty() { // 07-Mar-2017, tatu: Important to distinguish "none" from 'empty' value... assertNull(JsonTypeInfo.Value.from(null)); } + @Test public void testFromAnnotation() throws Exception { JsonTypeInfo.Value v1 = JsonTypeInfo.Value.from(Anno1.class.getAnnotation(JsonTypeInfo.class)); @@ -53,6 +59,7 @@ public void testFromAnnotation() throws Exception assertEquals("JsonTypeInfo.Value(idType=NAME,includeAs=EXTERNAL_PROPERTY,propertyName=ext,defaultImpl=java.lang.Void,idVisible=false,requireTypeIdForSubtypes=false)", v2.toString()); } + @Test public void testMutators() throws Exception { JsonTypeInfo.Value v = JsonTypeInfo.Value.from(Anno1.class.getAnnotation(JsonTypeInfo.class)); @@ -79,6 +86,7 @@ public void testMutators() throws Exception assertEquals("foobar", v.withPropertyName("foobar").getPropertyName()); } + @Test public void testWithRequireTypeIdForSubtypes() { JsonTypeInfo.Value empty = JsonTypeInfo.Value.EMPTY; assertNull(empty.getRequireTypeIdForSubtypes()); @@ -92,7 +100,8 @@ public void testWithRequireTypeIdForSubtypes() { JsonTypeInfo.Value requireTypeIdDefault = empty.withRequireTypeIdForSubtypes(null); assertNull(requireTypeIdDefault.getRequireTypeIdForSubtypes()); } - + + @Test public void testDefaultValueForRequireTypeIdForSubtypes() { // default value JsonTypeInfo.Value v3 = JsonTypeInfo.Value.from(Anno3.class.getAnnotation(JsonTypeInfo.class)); diff --git a/src/test/java/com/fasterxml/jackson/annotation/ObjectIdStuffTest.java b/src/test/java/com/fasterxml/jackson/annotation/ObjectIdStuffTest.java index ee14c8f5..1bfcbff8 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/ObjectIdStuffTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/ObjectIdStuffTest.java @@ -2,9 +2,14 @@ import java.util.UUID; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + // Test mostly to keep code coverage decent -public class ObjectIdStuffTest extends TestBase +public class ObjectIdStuffTest { + @Test public void testObjectIdGenerator() { ObjectIdGenerator.IdKey k = new ObjectIdGenerator.IdKey(String.class, Object.class, "id1"); @@ -21,6 +26,7 @@ public void testObjectIdGenerator() assertFalse(k2.equals(k)); } + @Test public void testIntSequenceGenerator() { ObjectIdGenerators.IntSequenceGenerator gen = new ObjectIdGenerators.IntSequenceGenerator(); @@ -30,6 +36,7 @@ public void testIntSequenceGenerator() assertEquals(Integer.valueOf(0), id); } + @Test public void testStringIdGenerator() { ObjectIdGenerators.StringIdGenerator gen = new ObjectIdGenerators.StringIdGenerator(); @@ -37,6 +44,7 @@ public void testStringIdGenerator() assertNotNull(id); } + @Test public void testUUIDGenerator() { ObjectIdGenerators.UUIDGenerator gen = new ObjectIdGenerators.UUIDGenerator(); diff --git a/src/test/java/com/fasterxml/jackson/annotation/OptBooleanTest.java b/src/test/java/com/fasterxml/jackson/annotation/OptBooleanTest.java index 5d5cae8f..fce6d42e 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/OptBooleanTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/OptBooleanTest.java @@ -1,8 +1,13 @@ package com.fasterxml.jackson.annotation; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + // Silly test for OptBoolean, for code coverage -public class OptBooleanTest extends TestBase +public class OptBooleanTest { + @Test public void testProperties() { assertTrue(OptBoolean.TRUE.asPrimitive()); diff --git a/src/test/java/com/fasterxml/jackson/annotation/PropertyAccessorTest.java b/src/test/java/com/fasterxml/jackson/annotation/PropertyAccessorTest.java index 39a3117c..781d6890 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/PropertyAccessorTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/PropertyAccessorTest.java @@ -1,8 +1,13 @@ package com.fasterxml.jackson.annotation; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + // Silly test for PropertyAccessor, for code coverage -public class PropertyAccessorTest extends TestBase +public class PropertyAccessorTest { + @Test public void testProperties() { assertTrue(PropertyAccessor.ALL.creatorEnabled()); diff --git a/src/test/java/com/fasterxml/jackson/annotation/TestBase.java b/src/test/java/com/fasterxml/jackson/annotation/TestBase.java deleted file mode 100644 index ab7f2a16..00000000 --- a/src/test/java/com/fasterxml/jackson/annotation/TestBase.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fasterxml.jackson.annotation; - -import junit.framework.TestCase; - -public abstract class TestBase extends TestCase -{ -} diff --git a/src/test/java/com/fasterxml/jackson/annotation/VisibilityTest.java b/src/test/java/com/fasterxml/jackson/annotation/VisibilityTest.java index 1a9cfec1..d358d027 100644 --- a/src/test/java/com/fasterxml/jackson/annotation/VisibilityTest.java +++ b/src/test/java/com/fasterxml/jackson/annotation/VisibilityTest.java @@ -4,8 +4,12 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + // Silly test for JsonAutoDetect.Visibility type, for code coverage -public class VisibilityTest extends TestBase +public class VisibilityTest { static class Bogus { public String value; @@ -21,6 +25,7 @@ private final static class Custom { } private final static JsonAutoDetect.Value NO_OVERRIDES = JsonAutoDetect.Value.noOverrides(); private final static JsonAutoDetect.Value DEFAULTS = JsonAutoDetect.Value.defaultVisibility(); + @Test public void testAnnotationProperties() throws Exception { Member m = Bogus.class.getField("value"); @@ -37,6 +42,7 @@ public void testAnnotationProperties() throws Exception assertFalse(JsonAutoDetect.Visibility.DEFAULT.isVisible(m)); } + @Test public void testBasicValueProperties() { JsonAutoDetect.Value v = JsonAutoDetect.Value.DEFAULT; assertEquals(JsonAutoDetect.class, v.valueFor()); @@ -53,6 +59,7 @@ public void testBasicValueProperties() { assertFalse(v.equals("foo")); } + @Test public void testEquality() { assertEquals(NO_OVERRIDES, NO_OVERRIDES); assertEquals(DEFAULTS, DEFAULTS); @@ -60,6 +67,7 @@ public void testEquality() { assertFalse(NO_OVERRIDES.equals(DEFAULTS)); } + @Test public void testFromAnnotation() { JsonAutoDetect ann = Custom.class.getAnnotation(JsonAutoDetect.class); @@ -76,6 +84,7 @@ public void testFromAnnotation() assertEquals(ann.creatorVisibility(), v.getCreatorVisibility()); } + @Test public void testToString() { assertEquals( "JsonAutoDetect.Value(fields=PUBLIC_ONLY,getters=PUBLIC_ONLY,"+ @@ -87,6 +96,7 @@ public void testToString() { JsonAutoDetect.Value.noOverrides().toString()); } + @Test public void testSimpleMerge() { JsonAutoDetect.Value base = JsonAutoDetect.Value.construct( Visibility.ANY, @@ -124,6 +134,7 @@ public void testSimpleMerge() { assertSame(overrides, JsonAutoDetect.Value.merge(overrides, null)); } + @Test public void testFactoryMethods() { JsonAutoDetect.Value v = JsonAutoDetect.Value.construct(PropertyAccessor.FIELD, Visibility.ANY); @@ -142,6 +153,7 @@ public void testFactoryMethods() { assertEquals(Visibility.NONE, all.getCreatorVisibility()); } + @Test public void testSimpleChanges() { assertSame(NO_OVERRIDES, NO_OVERRIDES.withFieldVisibility(Visibility.DEFAULT)); JsonAutoDetect.Value v = NO_OVERRIDES.withCreatorVisibility(Visibility.PUBLIC_ONLY);