【发布时间】:2020-01-26 15:55:03
【问题描述】:
我有一个使用这种方法的课程
@Test
public 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"));
}
我现在想对主题中的无效字符进行测试。发生这种情况时会引发以下异常:
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)
我该如何测试?
【问题讨论】:
标签: java unit-testing testing exception junit