- try {
- ParserIdentifier.toSchemaExportContextFromIdentifier(
- this.schemaContext, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider);
- fail("Test should fail due to invalid identifier supplied");
- } catch (final RestconfDocumentedException e) {
- assertEquals("Not expected error type",
- RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
- assertEquals("Not expected error tag",
- RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
- assertEquals("Not expected error status code",
- 400, e.getErrors().get(0).getErrorTag().getStatusCode());
- }
+ RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class,
+ () -> ParserIdentifier.toSchemaExportContextFromIdentifier(
+ SCHEMA_CONTEXT, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider));
+ assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType());
+ assertEquals("Not expected error tag", ErrorTag.INVALID_VALUE,
+ ex.getErrors().get(0).getErrorTag());