https://bz.apache.org/bugzilla/show_bug.cgi?id=64597

            Bug ID: 64597
           Summary: junitlauncher does not identify and execute unit test
                    which uses mocking framework Mockito
           Product: Ant
           Version: 1.10.5
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: mgan...@sscinc.com
  Target Milestone: ---

Hi,
The junitlauncher does not identify and execute unit test which uses mocking
framework Mockito. The other unit test cases which are not using the mocking
framework are identified and executed successfully. Also, the IntelliJ Idea IDE
successfully executes the unit test which uses mocking framework Mockito.

Execution Log:
 [junitlauncher] Test run finished after 0 ms
 [junitlauncher] [         1 containers found      ]
 [junitlauncher] [         0 containers skipped    ]
 [junitlauncher] [         1 containers started    ]
 [junitlauncher] [         0 containers aborted    ]
 [junitlauncher] [         1 containers successful ]
 [junitlauncher] [         0 containers failed     ]
 [junitlauncher] [         0 tests found           ]
 [junitlauncher] [         0 tests skipped         ]
 [junitlauncher] [         0 tests started         ]
 [junitlauncher] [         0 tests aborted         ]
 [junitlauncher] [         0 tests successful      ]
 [junitlauncher] [         0 tests failed          ]

Environment:
OS: Winodws 10 and Centos 7
IDE: IntelliJ Idea 2019.1.3, 2020.1
ANT: 1.10.5
Mockito: 3.3.3
JDK: OpenJDK 1.8 

Code:
@ExtendWith(MockitoExtension.class)
class FileHandlerTest {

    @Mock
    ServletContext application;

    @Test
    void getLegacyStaticFilePath() {
        FileHandler underTest = new FileHandler();
        when(application.getAttribute("envglobal")).thenReturn("windev");

        Map<String, String>
filePathMap=underTest.getLegacyStaticFilePath("csv",application);

        assertAll("static file path",
                () -> assertEquals("C:\\gta\\supportive_documents\\",
filePathMap.get("supportDoc")),
                () -> assertEquals("C:\\gta\\gtc_load\\",
filePathMap.get("loadDoc")),
                () -> assertEquals("C:\\gta\\ttg_reports\\",
filePathMap.get("ttgReportsDoc")));
    }
}

Other Observation:
Test report TEST-com.XXX.FileHandlerTest.txt created with 0 byte.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to