diff --git a/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/GroovyTest.groovy b/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/GroovyTest.groovy index 3fdb8c38..67dbbde2 100644 --- a/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/GroovyTest.groovy +++ b/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/GroovyTest.groovy @@ -1,61 +1,68 @@ package com.fasterxml.jackson.jr.passing -import org.junit.Test -import org.junit.Assert - import com.fasterxml.jackson.jr.ob.JSON +import org.junit.Assert +import org.junit.Test -class GroovyTest -{ +class GroovyTest { @Test void testSimpleGroovyObject() throws Exception { def json = JSON.std.asString(new GroovyOb()) def expected = """{"AAAAA_A_Field_Starting_With_Two_Capital_Letters":"XYZ","aDouble":0.0,"aPublicInitializedInteger":56,"aPublicInitializedIntegerObject":1516,"aPublicUninitializedInteger":0,"anInitializedIntegerObject":1112,"anInitializedPublicString":"stringData","anInitializedString":"ABC","anInteger":0,"anIntegerWithValue":12}""" Assert.assertEquals(json, expected) } + + @Test + void testRecord() throws Exception { + def json = JSON.std.asString(new Cow("foo", Map.of("foo", "bar"))) + def expected = """{"message":"foo","object":{"foo":"bar"}}""" + Assert.assertEquals(json, expected) + } } class GroovyOb { - int anInteger - int anIntegerWithValue = 12 + int anInteger + int anIntegerWithValue = 12 - static int anStaticInteger = 34 - static int anStaticIntegerWithValue = 34 + static int anStaticInteger = 34 + static int anStaticIntegerWithValue = 34 - public int aPublicUninitializedInteger - public int aPublicInitializedInteger = 56 + public int aPublicUninitializedInteger + public int aPublicInitializedInteger = 56 - private int aPrivateUninitializedInteger - private int aPrivateInitializedInteger = 78 + private int aPrivateUninitializedInteger + private int aPrivateInitializedInteger = 78 - public static int aPublicStaticUninitializedInteger - public static int aPublicStaticInitializedInteger = 910 + public static int aPublicStaticUninitializedInteger + public static int aPublicStaticInitializedInteger = 910 - Integer anIntegerObject - Integer anInitializedIntegerObject = 1112 + Integer anIntegerObject + Integer anInitializedIntegerObject = 1112 - static Integer aStaticIntegerObject - static Integer aStaticInitializedIntegerObject = 1314 + static Integer aStaticIntegerObject + static Integer aStaticInitializedIntegerObject = 1314 - public Integer aPublicUninitializedIntegerObject - public Integer aPublicInitializedIntegerObject = 1516 + public Integer aPublicUninitializedIntegerObject + public Integer aPublicInitializedIntegerObject = 1516 - public static Integer aPublicStaticUninitializedIntegerObject - public static Integer aPublicStaticInitializedIntegerObject = 1718 + public static Integer aPublicStaticUninitializedIntegerObject + public static Integer aPublicStaticInitializedIntegerObject = 1718 - String aString - String anInitializedString = "ABC" + String aString + String anInitializedString = "ABC" - static String aStaticString = "jacksonJR" + static String aStaticString = "jacksonJR" - public String aPublicString - public String anInitializedPublicString = "stringData" + public String aPublicString + public String anInitializedPublicString = "stringData" - public String AAAAA_A_Field_Starting_With_Two_Capital_Letters = "XYZ" - //Other Items - public static String staticStr = "jacksonJR" // Public Static Object - static int anStaticInt // Uninitialized Static Object - public double aDouble // uninitialized primitive - public Double aDoubleObject // testing boxing object - private int hiddenvalue = 123 // private value + public String AAAAA_A_Field_Starting_With_Two_Capital_Letters = "XYZ" + //Other Items + public static String staticStr = "jacksonJR" // Public Static Object + static int anStaticInt // Uninitialized Static Object + public double aDouble // uninitialized primitive + public Double aDoubleObject // testing boxing object + private int hiddenvalue = 123 // private value } + +record Cow(String message, Map object) {} diff --git a/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/ReadRecordTest.groovy b/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/ReadRecordTest.groovy index 5c691930..c50f49e4 100644 --- a/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/ReadRecordTest.groovy +++ b/jr-objects/src/test/groovy/com/fasterxml/jackson/jr/passing/ReadRecordTest.groovy @@ -1,17 +1,3 @@ package com.fasterxml.jackson.jr.passing -import com.fasterxml.jackson.jr.ob.JSON -import org.junit.Assert -import org.junit.Test - -class ReadRecordTest { - @Test - void testSimpleGroovyObject() throws Exception { - def json = JSON.std.asString(new Cow("foo", Map.of("foo", "bar"))) - def expected = """{"message":"foo","object":{"foo":"bar"}}""" - Assert.assertEquals(json, expected) - } -} - -record Cow(String message, Map object) {}