Skip to content

Commit

Permalink
added a test to check for regressions in JENKINS-15105.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Sep 11, 2012
1 parent 6b4bf06 commit 1b3eb0b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions core/src/test/java/jenkins/ResilientJsonObjectTest.java
@@ -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;
}
}

1 comment on commit 1b3eb0b

@jglick
Copy link
Member

@jglick jglick commented on 1b3eb0b Sep 11, 2012

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?

Please sign in to comment.