Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a test to check for regressions in JENKINS-15105.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package jenkins; | ||
|
||
import net.sf.json.JSONObject; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Bug; | ||
|
||
/** | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class ResilientJsonObjectTest { | ||
public static class Foo { int a; } | ||
|
||
/** | ||
* {@link JSONObject} databinding should be able to ignore non-existent fields. | ||
*/ | ||
@Test | ||
@Bug(15105) | ||
public void databindingShouldIgnoreUnrecognizedJsonProperty() { | ||
JSONObject o = JSONObject.fromObject("{a:1,b:2}"); | ||
Foo f = (Foo)JSONObject.toBean(o,Foo.class); | ||
assert f.a == 1; | ||
} | ||
} |
1b3eb0b
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.
Doesn’t this test belong in the upstream project?