+
+ /**
+ * Test of Yang Patch on the top augmented element.
+ */
+ @Test
+ public void modulePatchTargetTopLevelAugmentedContainerTest() throws Exception {
+ mockBodyReader("", jsonToPatchBodyReader, false);
+ final var inputStream = new ByteArrayInputStream(("{\n"
+ + " \"ietf-yang-patch:yang-patch\": {\n"
+ + " \"patch-id\": \"test-patch\",\n"
+ + " \"comment\": \"comment\",\n"
+ + " \"edit\": [\n"
+ + " {\n"
+ + " \"edit-id\": \"edit1\",\n"
+ + " \"operation\": \"replace\",\n"
+ + " \"target\": \"/test-m:container-root/test-m:container-lvl1/test-m-aug:container-aug\",\n"
+ + " \"value\": {\n"
+ + " \"container-aug\": {\n"
+ + " \"leaf-aug\": \"data\"\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + "}").getBytes(StandardCharsets.UTF_8));
+ final var expectedData = Builders.containerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(CONT_AUG_QNAME))
+ .withChild(ImmutableNodes.leafNode(LEAF_AUG_QNAME, "data"))
+ .build();
+ final var returnValue = jsonToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream);
+ checkPatchContext(returnValue);
+ final var data = returnValue.getData().get(0).getNode();
+ assertEquals(CONT_AUG_QNAME, data.getIdentifier().getNodeType());
+ assertEquals(expectedData, data);
+ }