private static void checkProp(Schema s0) throws Exception { if (s0.getType().equals(Schema.Type.UNION)) return; // unions have no props assertEquals(null, s0.getProp("foo")); Schema s1 = Schema.parse(s0.toString()); s1.addProp("foo", "bar"); assertEquals("bar", s1.getProp("foo")); assertFalse(s0.equals(s1)); Schema s2 = Schema.parse(s1.toString()); assertEquals("bar", s2.getProp("foo")); assertEquals(s1, s2); assertFalse(s0.equals(s2)); }
@Test public void testComplexProp() throws Exception { String json = "{\"type\":\"null\", \"foo\": [0]}"; Schema s = Schema.parse(json); assertEquals(null, s.getProp("foo")); }