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

Questions tagged [junit5]

Version 5 of the popular JUnit testing framework for the JVM. JUnit is a framework for writing repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

junit5
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 ...
Buddhaman's user avatar
0 votes
1 answer
11 views

How to separate retires in Allure Reports to separate tests?

In my project while triggering a test to run, we pass through variables as system properties e.g.: public static String USER = System.getProperty("user", "ADMIN_HQ"); This is so ...
Hazel Egan's user avatar
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: ...
crusy's user avatar
  • 1,492
0 votes
1 answer
14 views

java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked

I got this error when I use JUnit5 for Unit testing: java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked. at android.os.Looper.getMainLooper(Looper.java) at androidx.arch....
Mona Baharlou's user avatar
0 votes
0 answers
23 views

ParameterizedTest JUNIT5 with suspend functions

I'm trying to clean a little bit my code and when testing my datasource I'm repeating a lot the test that returns connection and service error, and I'd like to have a bunch of code that tests ...
StuartDTO's user avatar
  • 891
0 votes
1 answer
35 views

Mockito and Spring RestTemplate issue

I want to test this class : public class TokenIntrospector { private RestTemplate restTemplate; private String userInfoUri = "http://localhost"; public TokenIntrospector(...
AntonBoarf's user avatar
  • 1,283
0 votes
2 answers
25 views

Harcoding PortNumber for mockserver using testcontainers

I am using testcontainers to create a mockserver in JUnit5. It seems the port number changes for every run randomly, I want it to have a fix port number, which I will decide. how this can be done ? ...
Suman Shekhar's user avatar
1 vote
1 answer
60 views

Junit 5 "ParameterResolutionException: Failed to resolve parameter [java.lang.String arg0]"

I want to test this constructor with different name parameters. public Horse(String name, double speed, double distance) { if (isNull(name)) { throw new IllegalArgumentException("Name ...
k0ct0pka's user avatar
-1 votes
0 answers
14 views

how to write junit test case for public method which internally call private method which is in same class [duplicate]

I have a publicMethod() and privateMethod,publicMethod() internally calls the privateMethod() and private method return a string in response. how to write test case for such scenarios. code: class{ ...
Nishant Bodade's user avatar
-2 votes
0 answers
23 views

Java CompletableFuture test exceptionally-block

i wanna test my "exceptionally"-Block of CompletableFuture. I've already wrote a test, but is fails. public CompletableFuture<Void> handleRequest(Request request) { ...
Roma Kap's user avatar
  • 543
0 votes
1 answer
24 views

JUnit 5 - Migration - Custom test annotation no longer detected?

I had the following custom test annotation that worked in JUnit4 that IntelliJ and JUnit no longer wants to recognize: @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RUNTIME) ...
David S's user avatar
  • 177
0 votes
1 answer
58 views

Out of Bound Exceptions

Please help me to solve the problem in selenium java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 7 code : package adipolipkg; import org.junit.Before; import org....
thensage's user avatar
0 votes
1 answer
36 views

Transactional (mybatis-cdi: org.mybatis.cdi.Transactional) annotation with rollbackOnly=true not rollbacking transactions inside a Weld / JUnit 5 test

I expect this class UserMapperTest.java to run the test rollbacking the transaction (in this case for a simple insert, where the field email is unique, but the core of the problem is about the ...
madx's user avatar
  • 7,059
0 votes
0 answers
26 views

Intellij Idea: Unrecognized VM option 'UseSplitVerifier' While running Junit

Jdk: 17.0.1 Intellij: IntelliJ IDEA 2024.1.4 OS: Linux. When I run Junit i see the error Unrecognized VM option 'UseSplitVerifier' That argument is not added in any of the configurations or pom.xml....
rocktherock21's user avatar
1 vote
0 answers
68 views

TestEngine with ID 'junit-jupiter' failed to discover tests in Maven configuration

I have a maven project with system and unit tests. I want to run JUnit plugin tests in headless mode. When I run the JUnit plugin tests from Eclipse using the option Run As -> JUnit Plugin Tests, ...
jrao's user avatar
  • 47

15 30 50 per page
1
2 3 4 5
249