A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/358 below:

[java] Mockito verify method is not taken into account in JUnitTestsShouldIncludeAssert rule · Issue #358 · pmd/pmd · GitHub

Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex]. If not specific to a language, you can use [core]

Rule Set:
pmd-unit-tests:JUnitTestsShouldIncludeAssert

Description:
when unit test method includes only Mockito verify check then JUnit tests should include assert() or fail() is reported which is in this case false positive.

Code Sample demonstrating the issue:

    @Test
    public void doGet_ProvideNullFile_CheckResponse() throws ServletException, IOException {
      FileDownload download = new FileDownload();
      HttpServletRequest request = mock(HttpServletRequest.class);
      HttpServletResponse response = mock(HttpServletResponse.class);
      
      
      download.doGet(request, response);
      verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
   }

Running PMD through: [Other] - SonarQube

thinhnn, EranBoudjnah and umutozk


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4