提交 1b3eb0b9 编写于 作者: K Kohsuke Kawaguchi

added a test to check for regressions in JENKINS-15105.

上级 6b4bf064
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;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册