Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [junit]

Popular unit testing framework for Java and Scala. The latest version, JUnit 5, supports rich annotation-based and parameterized tests. Consider using in conjunction with the Java or Scala tag to indicate your use case.

8 votes
5 answers
17k views

Run a single Junit Test in IntelliJ IDEA

I am new in IntelliJ IDEA and I want to execute a single Junit test as I do in Eclipse but I haven't seen this option
0 votes
0 answers
9 views

JUnit test failing Status expected:<201> but was:<404>

I've spent a lot of time trying to figure out this issue, but when I'm running my tests on my UserControllerTest class I'm getting Status expected:<201> but was:<404>. Here's my ...
2 votes
3 answers
2k views

Mockito - InvalidUseOfMatchersException while running using maven, but working directly from eclipse

I have mock method for a rest call. public void createRestClientMock() { org.mockito.Mockito.when( restClient.sendResponse(org.mockito.Matchers.anyString(), ...
0 votes
0 answers
11 views

How to test flow paging data for an android application?

I'm currently testing repository class in my Android App, the function itself returns Flow<PagingData>. When I run the test it gives an error : After waiting for 1m, the test coroutine is not ...
0 votes
1 answer
13k views

java.lang.NoClassDefFoundError: gherkin/formatter/Reporter for Cucumber with extent reports

I am trying to generate extent report for my test case using Cucumber and Extent report using JUnit. But I am getting: java.lang.NoClassDefFoundError: gherkin/formatter/Reporter and java.lang....
0 votes
0 answers
13 views

I'm trying to work testcode about Java Spring Boot 6.x Websocket code with STOMP but in trouble

public class WebSocketIntegrationTest { @LocalServerPort private int port; @Autowired private MockMvc mockMvc; @Autowired private ObjectMapper objectMapper; private ...
2 votes
1 answer
337 views

Use ArgumentCaptor outside of .verify()?

I have an entity which is not used as an argument in a .verify(), but only an attribute of that entity. However, I would like to capture the entity to later use assertEquals to verify another ...
2 votes
1 answer
11k views

How to properly emulate FeignClient responses in JUnit tests

I am using FeignClient for communication between microservices. I would like to test one microservice without running the other, so I need somehow to emulate responses from it. At this time I am ...
0 votes
1 answer
42 views

Group (or merge) @Unroll tests from Spock in JUnit XML result file

I have a Spock @Unroll test like this: @Unroll def 'A session uses the TLS protocol #enabledProtocolsOfSocket #protocolOfSession'() { given: // ... expect: // ... where: ...
0 votes
2 answers
10k views

how to measure code coverage by junit test with sonar for non maven project

I have scanned my project with the help of sonar runner and sonar qube, but in the results i am not able to see the coverage details and test cases details. can any one tell me the process for code ...
0 votes
1 answer
27 views

Playwright Junit file into X-ray

I am able to generate a results.xml file using playwright execution and also upload to JIRA. However, my screenshot/video from the execution are not reported back into X-Ray. I can see in xml file, ...
0 votes
0 answers
26 views

How to write verify for static methods that have been called [in Mockito Core] [duplicate]

Without using PowerMockito and using Mockito-Core (the version of Mockito doesn't support PowerMockito and I cannot change the Mockito version), How can I verify that a call to a static method has ...
55 votes
3 answers
51k views

Selenium cannot find SVG element in XPath

I have the following HTML: <div id="imageholder> <svg> <g> <image href='blah.gif'> </g> </svg> </div> And I cannot seem to locate the svg ...
1 vote
0 answers
27 views

JerseyTest and Mockito - problem with mocking an object

My aim is to learn a little bit about mocking objects in the context of Jersey Test. I have 3 classes: ServiceController package com.vogella.jersey.first; import javax.ws.rs.*; import javax.ws.rs.ext....
8 votes
1 answer
10k views

Configuration failures resulting into Test skip in TestNG with no information in XMLs

I am experimenting with TestNG and it is working from eclipse. I created a test suite and trying to run it from command line. Build fails with error saying Final output during build says: [...

15 30 50 per page
1
2 3 4 5
1871