这两段代码一直给我')'预期的错误,但是当我添加一个)时,它总是说同样的事情,并且有一个意外的标记。我用标记了')'的预期位置
@Test
public void testFindDocumentById() {
when(new ApiResponse.findDocumentById()).thenReturn(testFindDocumentById(); <----
assertThat(documentImpl.getId());
}
@Test
public void testModifyDocument() throws MalformedURLException {
when(apiResponseMock.modifyDocument((java.lang.String) String)).thenReturn(testModifyDocument(); <--
assertThat(ApiResponse.saveOrUpdateDocument);
}
当方括号内有方法时,请注意开头和结尾处有多少个括号。
给出:
public String printMessage() {
return "This is a message";
}
这将不起作用:
System.out.prinln(printMessage();
这将是由于末尾有多余的)。
System.out.prinln(printMessage());