- @Test
- public void incorrectTopLevelElementTest() throws WebApplicationException, IOException {
- String jsonOutput = null;
- jsonOutput = TestUtils
- .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
- Collections.<Module>emptySet(), prepareDataSchemaNode(),
- StructuredDataToJsonProvider.INSTANCE);
- assertNotNull(jsonOutput);
- assertTrue(jsonOutput.contains("\"lf1\": \"\""));
- }
-
- private CompositeNode prepareCompositeNode() {
- MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
- TestUtils.buildQName("cont", "simple:uri", "2012-12-17"), null, null, ModifyAction.CREATE, null);
- MutableSimpleNode<?> lf1 = NodeFactory.createMutableSimpleNode(
- TestUtils.buildQName("lf1", "simple:uri", "2012-12-17"), cont, "any value", ModifyAction.CREATE, null);
- cont.getValue().add(lf1);
- cont.init();
- return cont;
- }
-