@Test public void modulePATCHDataTest() throws Exception { final String uri = MOUNT_POINT + "/instance-identifier-patch-module:patch-cont/my-list1/leaf1"; mockBodyReader(uri, jsonPATCHBodyReader, false); final InputStream inputStream = TestJsonBodyReader.class.getResourceAsStream("/instanceidentifier/json/jsonPATCHdata.json"); final PATCHContext returnValue = jsonPATCHBodyReader.readFrom(null, null, null, mediaType, null, inputStream); checkPATCHContextMountPoint(returnValue); }
/** * Test trying to use PATCH create operation which requires value without value. Test should fail * with {@link RestconfDocumentedException} with error code 400. */ @Test public void modulePATCHValueMissingNegativeTest() throws Exception { final String uri = MOUNT_POINT + "/instance-identifier-patch-module:patch-cont/my-list1/leaf1"; mockBodyReader(uri, jsonPATCHBodyReader, false); final InputStream inputStream = TestJsonBodyReader.class.getResourceAsStream( "/instanceidentifier/json/jsonPATCHdataValueMissing.json"); try { jsonPATCHBodyReader.readFrom(null, null, null, mediaType, null, inputStream); fail( "Test should return error 400 due to missing value node when attempt to invoke create operation"); } catch (final RestconfDocumentedException e) { assertEquals( "Error code 400 expected", 400, e.getErrors().get(0).getErrorTag().getStatusCode()); } }