希望继续')'吗?如何解决?

问题描述 投票:-4回答:1

这两段代码一直给我')'预期的错误,但是当我添加一个)时,它总是说同样的事情,并且有一个意外的标记。我用标记了')'的预期位置

    @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);
    }
java spring-boot unit-testing syntax syntax-error
1个回答
0
投票

当方括号内有方法时,请注意开头和结尾处有多少个括号。

给出:

public String printMessage() {
   return "This is a message";
}

这将不起作用:

System.out.prinln(printMessage();

这将是由于末尾有多余的)。

System.out.prinln(printMessage());
© www.soinside.com 2019 - 2024. All rights reserved.