Quantcast
Channel: Java test for an exception - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Java test for an exception

$
0
0

I have a class with this method

@Testpublic void testWithOriginalPattern() throws Exception {  this.OBJCET_CONTENT ="{\"service_instance\": \"foo\", \"notifications\": {\"subject\": \"bar0-9A-Za-z-._\"}}";  final HttpServletRequest request = createGoodRequest(this.OBJCET_CONTENT);  final ContainerMetadataManagementServlet containerMetadataManagementServlet =      new MockContainerMetadataManagementServlet();  assertNotNull(containerMetadataManagementServlet.runGetConfig(request, "/service-api-create-bucket-schema.json"));}

I now want to do the test with invalid characters in the subject. When this happens the following exception is thrown:

HttpException(400,{"status_code":400,"error_code":"MalformedNotificationsError","uri":"uri","message":"The provided JSON was not well-formed or did not validate against the published schema."},null)

How do I test for that?


Viewing all articles
Browse latest Browse all 4

Trending Articles