292 questions
0
votes
0
answers
18
views
Precise control of time when testing the Spring test code
I'm trying to write a test code to find out about TDD.
I'm trying to avoid using Thread and find out how to calculate the exact time to comply with the fast processing among the FIRST principles.
Test ...
0
votes
1
answer
46
views
Repeated parameterized test with JUnit 5 / Jupiter
I want to repeatedly execute the following test class:
class Test {
static Foo foo;
@BeforeAll
static void setUpAll() {
foo = generateRandomFoo();
}
@ParameterizedTest
...
0
votes
2
answers
45
views
How can I override super.nested test class?
Say, I have an abstract superclass and an abstract test class for testing subclasses.
abstract class Superclass {
}
@RequiredArgsConstructor
abstract class SuperclassTest<T extends Superclass> {...
4
votes
2
answers
295
views
Junit Jupiter failes to discover tests
While updating junit from 5.11.4 to 5.12.1 my Java Program failes to perform tests with the following exception:
Mär 31, 2025 1:34:48 PM org.junit.platform.launcher.core.DefaultLauncher ...
0
votes
1
answer
39
views
MojoFailureException: No tests were executed! Passes when run in VSCode/Intellij, fails in Maven, other tests pass in Maven
When I run this test from VSCode or Intellij it works fine.
When I run it from Maven using the command below it fails.
Getting this error:
org.apache.maven.plugin.MojoFailureException: No tests were ...
0
votes
0
answers
41
views
SpringBoot 3 + Junit5 + Cucumber : Junit Runner don't see cucumber tests
I have to start integration testing in a new springboot project and I'm struggle with Junit and Cucumber.
Java 23
Spring Boot 3.4.3
Gradle
Cucumber 7.20.1
Junit 5
I added these dependencies
...
3
votes
2
answers
122
views
Not able to use junit5-system-exit
I'm trying to write some unit tests for a command line application which makes use of System.exit(1) to signal a failed execution.
Since we are using Java 21, in order to avoid problems with the ...
-1
votes
1
answer
55
views
How do I exclude an ArchUnit rule aiming at interface to impact @interface (annotation)
I would like to write an ArchUnit test which says:
"the classes that are interfaces should have a name ending with Interface, but not the @interface ones (they are annotations)".
For ...
2
votes
1
answer
45
views
How to add executables of "assertAll()" to a list and execute them at the end of the test method?
The following JUnit Jupiter Tests with Mockito are working fine:
@Test
void testVerifMethod() {
System.out.println("*** Start test verify method ***");
mockedList....
1
vote
0
answers
24
views
LiveData test fails: Expected MyState$Success, but got null in ViewModel test with coroutines [duplicate]
Problem Description:
I was expecting the LiveData value to be MyState$Success when the test starts, but the value is already set to null.
Questions:
Is the LiveData emitting its value asynchronously ...
1
vote
0
answers
36
views
Spring load TestPropertySource OR PropertySource (but not both) based on condition
I have a TestBase class that is extended by all test classes. This class runs locally from IntelliJ if the @PropertySource("classpath:/test.properties") is used on it it runs properly in the ...
1
vote
0
answers
44
views
JUnit test suite custom selector
I have a custom annotation that maps my tests to a Jira key.
@Jira("jira-T123")
I want to create a test suite selector that takes a list of Jira keys as a parameter, it then runs any test ...
0
votes
0
answers
72
views
Spring Rabbit Test - Requeue on AmqpRejectAndDontRequeueException Not Working
I’m trying to execute a test using Spring Boot with the 'spring-rabbit-test' dependency. My application flow involves a calls a service, which processes messages in parallel using RabbitMQ queues. In ...
0
votes
0
answers
423
views
org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [int arg0] in constructor
I'm migrating our tests from Junit4 to Junit5, one of which is a base test class that's been inherited by 29 other classes with a constructor.
I changed it to use Junit5, the structure is like below:
...
0
votes
1
answer
319
views
How to fully recreate a Testcontainers container before each test?
I'm looking for a solution to have a new container for each test. My issue is that the data that I insert in the database in my first test will interferer the second test. Every test works ...