private PropertyGroupContainer validateSize(String json, int count) { PropertyGroupContainer ret = new PropertyGroupContainer(json); assertEquals(count, ret.getNumGroups()); return ret; }
public void testToJson() { PropertyGroupContainer container1 = new PropertyGroupContainer("{}"); // $NON-NLS-1$ PropertyGroup group = new PropertyGroup(); Property property = new Property( JSONParser.parseStrict( "{\"id\":\"blah-test-1.304116363485E12\",\"name\":\"\",\"label\":\"my widget\",\"description\":\"\",\"type\":\"\",\"isVisible\":true,\"value\":\"\",\"order\":0}") //$NON-NLS-1$ .isObject()); group.add(property); container1.add(group); JSONObject json1 = container1.toJson(); PropertyGroupContainer container2 = new PropertyGroupContainer(json1.toString()); JSONObject json2 = container2.toJson(); UnitTestUtil.equalsIgnoreOrder(json1, json2); }
private void validateBaseClassInitialization( PropertyGroupContainer container, String name, String desc, String type, String templateId) { assertNotNull(container); String test = container.getName(); assertTrue(test.equals(name)); test = container.getDescription(); assertTrue(test.equals(desc)); test = container.getType(); assertTrue(test.equals(type)); test = container.getId(); assertTrue(test.equals(templateId)); }