-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skipping over groovy metadata class + groovy test. #118
Changes from 3 commits
f0940d7
b1c4ee2
ee4bc8d
3b11f5b
2ea10d9
33ce437
b2fb57c
0566e93
0f96433
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.fasterxml.jackson.jr | ||
|
||
import com.fasterxml.jackson.jr.ob.JSON | ||
import com.fasterxml.jackson.jr.ob.TestBase | ||
|
||
class GroovyTest extends TestBase { | ||
|
||
void testSimpleObject() throws Exception { | ||
var data = JSON.std.asString(new MyClass()) | ||
var 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}""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was about to ask about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One question tho: how does this test get run? It doesn't look like it runs with Maybe test would need to be under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per that (moving test) is one of 3 things needed, fwtw. |
||
assertEquals(data, expected) | ||
} | ||
|
||
private class MyClass { | ||
int anInteger | ||
int anIntegerWithValue = 12 | ||
|
||
static int anStaticInteger = 34 | ||
static int anStaticIntegerWithValue = 34 | ||
|
||
public int aPublicUninitializedInteger | ||
public int aPublicInitializedInteger = 56 | ||
|
||
private int aPrivateUninitializedInteger | ||
private int aPrivateInitializedInteger = 78 | ||
|
||
public static int aPublicStaticUninitializedInteger | ||
public static int aPublicStaticInitializedInteger = 910 | ||
|
||
Integer anIntegerObject | ||
Integer anInitializedIntegerObject = 1112 | ||
|
||
static Integer aStaticIntegerObject | ||
static Integer aStaticInitializedIntegerObject = 1314 | ||
|
||
public Integer aPublicUninitializedIntegerObject | ||
public Integer aPublicInitializedIntegerObject = 1516 | ||
|
||
public static Integer aPublicStaticUninitializedIntegerObject | ||
public static Integer aPublicStaticInitializedIntegerObject = 1718 | ||
|
||
String aString | ||
String anInitializedString = "ABC" | ||
|
||
static String aStaticString = "jacksonJR" | ||
|
||
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 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check for class name, not just package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes correct!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially i implemented it to check for just MetaClassImpl, but after checking jackson-databind, i just replicated its exclusion.
https://github.com/FasterXML/jackson-databind/blob/db95863d6f48cb5695bf8e14af1e7af2ece8e52e/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java#L205
is this correct? or should we go for targeted exclusions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note calling line:
https://github.com/FasterXML/jackson-databind/blob/db95863d6f48cb5695bf8e14af1e7af2ece8e52e/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java#L59
which actually checks class name: helper method name is bit misleading I agree. But yes, I think we should target to just that class, unless proven something else is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understood, I missed this code, will implement in a similar fashion.