Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
258 views

I have the following errors using Java 17 with Spring Boot 4.0.0: Cannot resolve symbol 'DataJpaTest' Cannot resolve symbol 'AutoConfigureTestDatabase' The problem happens in a JUnit test class ...
Aliuk's user avatar
  • 1,417
1 vote
1 answer
39 views

I have "simple" Junit5 Test which I would like to run with Weld. The test fails, because observer method is invoked on other instance of test class as the one which was started. Even thou I ...
dkalna's user avatar
  • 77
0 votes
0 answers
54 views

I am using Mockito 5.20.0 to mock a static method, but the mock is not correctly closing / the mocked behavior is leaking outside of the tests it is intended to apply to. This is only a problem if ...
PunDefeated's user avatar
2 votes
1 answer
118 views

I'm organizing my tests using JUnit 5's @Suite and @SelectClasses, but need to control the execution sequence of the test classes. According to the documentation, @SelectClasses doesn't guarantee ...
Abhiram Reddy Milkuri's user avatar
0 votes
0 answers
26 views

When running OpenRewrite on my multi module project (Maven 3.99, Java 21) with this configuration in the root pom: <plugin> <groupId>org.openrewrite.maven</groupId> ...
Uwe Allner's user avatar
  • 3,487
1 vote
0 answers
69 views

I am trying to create a fat JAR that includes my application and its tests to run them externally using the JUnit Console Launcher. The build succeeds, and the JAR is created. However, when I execute ...
novengail's user avatar
0 votes
0 answers
72 views

I have a springboot maven project in which I have a very simple class which has a static method which takes in a http client, some configs and an object mapper This class is under package com.cs....
vineeth's user avatar
  • 16
1 vote
1 answer
89 views

When I tried to integrate ArchUnit into our setup, I noticed that ArchUnit tests were not being picked up by Gradle. Our Gradle config contains several testing tasks to separate UnitTests, ...
Sebastian Sprenger's user avatar
0 votes
0 answers
45 views

I'm in the process of converting my Java Maven repository from Junit 4 to Junit 5. After updating my methods, runner, and POM, I can run the tests locally in Intellij, but when running them on AWS ...
Will Preston's user avatar
0 votes
1 answer
73 views

I'm making a JUnit test class for a java class in Eclipse and I'm unsure of what steps to take to fix it. I tried to add the JUnit 5 Library to the build path as part of "Fix project setup",...
Aspen's user avatar
  • 11
0 votes
1 answer
46 views

How can you make an assumption that checks if a test is executed in an interactive session? FEST robot clicks and such are ignored on the CI server now since the session is not interactive, but I don'...
Sergey Zolotarev's user avatar
2 votes
2 answers
100 views

How do I assert on Swing modal dialogs? The problem: I can't show a dialog synchronously — it would block the thread indefinitely. I can pass it to SwingUtilities#invokeLater, but can neither assert ...
Sergey Zolotarev's user avatar
-4 votes
1 answer
222 views

Related: Rethrowing Throwables from EDT I want to test my InvocationInterceptor that runs tests in event dispatching thread (EDT). Among other things, it shouldn't swallow any Throwables. I wrote a ...
Sergey Zolotarev's user avatar
2 votes
2 answers
151 views

I keep hearing this recommendation to always access Swing components on the EDT, including in tests. In plain Java, it usually means calling invokeLater() / invokeAndWait(). Indeed, some tests do ...
Sergey Zolotarev's user avatar
2 votes
1 answer
146 views

I have a Java test class setup with Mockito and get some strange behavior. My class looks as follows: @ExtendWith(MockitoExtension.class) public class FrameworkTest { @Mock private OrderService ...
Mathias Bader's user avatar
3 votes
0 answers
88 views

Take a @Validated class and a method with a parameter annotated @NotBlank from jakarta-validation-api 3.0.2. @Validated public class Foo { public void bar(@NotBlank String baz) { } } How ...
o.m.'s user avatar
  • 238
0 votes
1 answer
105 views

After days of trying I did not find a way to let the Maven build fail if a Cucumber scenario fails. What am I missing? Here a minimal example of that build setup. It uses Maven Wrapper to simplify ...
Frank's user avatar
  • 31
1 vote
1 answer
78 views

I have multi module android project where I am doing junit4 to junit5 migration For CoroutineTestRule I have added CoroutineTestExtension but it's not working well when parallel test execution is ...
OneDream Project's user avatar
1 vote
1 answer
112 views

I am trying to mock a constructor method. But failed with messages said unnecessary stubbings. What modify should I make to succesfully run this unit test? Plus, Better not to modify the version of ...
Django47's user avatar
0 votes
0 answers
37 views

I am trying to move an app from Java 11 to 17. Maven compile goes fine, but if I try to run tests I get a lot of "NoClassDefFound javax/enterprise/inject/spi/BeanManager" errors. I excluded ...
Francesco's user avatar
  • 1,857
0 votes
2 answers
56 views

This is part of my pom.xml: <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.5.3</version> <configuration> <excludedGroups>slow<...
yegor256's user avatar
  • 106k
0 votes
0 answers
63 views

I'm writing unit tests for my Ktor 2.3.0 application using Koin 3.4.0 for dependency injection and MockK for mocking. I want to test my controllers using testApplication {} from ktor-server-test-host. ...
Vasco Sousa's user avatar
0 votes
0 answers
29 views

Does JUnit 5 provide an inclusion mechanism that allows splitting a test class's methods into groups, distributing each group into separate class files, and then selectively executing some or all of ...
walsh's user avatar
  • 3,313
1 vote
1 answer
40 views

for JUnit 5 is it possible to create a class which executed (an object of this class...) before any of the junit tests are executed? In my case I would like to setup some logging before the tests ...
Rene Zillmann's user avatar
0 votes
1 answer
41 views

I have a method that creates a Specification (Spring JPA) from my custom object to check if its attribute is False with the method. Using Mockito, I tried do the unit test below. void ...
bogu399's user avatar
  • 43
1 vote
0 answers
82 views

I am trying out unit testing in Java with JUnit for an assignment. Previously, we were tasked with creating a generic puzzle-solving algorithm using graph searching algorithms. The important part is ...
Nir'sCousin's user avatar
2 votes
2 answers
170 views

I want to do some integration testing + setup local dev environment for a Java/Spring Boot application that interacts with Kubernetes via Argo Workflows. I don't see a Kubernetes test container (...
Michael Dausmann's user avatar
0 votes
1 answer
189 views

I have a project that runs the tests fine in Eclipse. If I run mvn verify after Eclipse compiled the project, at first sight it seems to run every test class fine, just runs 0 tests in each of them. ...
Árpád Magosányi's user avatar
0 votes
1 answer
196 views

I want to repeatedly execute the following test class: class Test { static Foo foo; @BeforeAll static void setUpAll() { foo = generateRandomFoo(); } @ParameterizedTest ...
Борат Сагдиев's user avatar
1 vote
0 answers
75 views

I am developing a project and I am now creating junits for parts of my code where I use a mongo DB connection. On my actual DB it works fine but I am trying to set up an embedded DB to run my tests on ...
Luís Casqueiro's user avatar
0 votes
0 answers
54 views

I have created a library using Spring to send message using Kafka Template. I am using the library in Spring boot application. The configuration fields are fetched from application.yml in Sprint boot ...
Thiagarajan Ramanathan's user avatar
1 vote
0 answers
322 views

I've updated the version of Spring Boot in my project to 3.4.4. And now one of the JUnit tests starts failing with the exception org.springframework.beans.BeanInstantiationException: Failed to ...
zilberman's user avatar
0 votes
1 answer
162 views

stack: OpenJDK Zulu21.40+17-CA (build 21.0.6+7-LTS), Google Chrome 134.0.6998.117 (stable), Gradle, Junit5, Fedora 41 (the same thing happened on windows 11) the problem: I am writing autotests for an ...
janikiplayaz's user avatar
0 votes
0 answers
63 views

I have this code which I want to to test with JUnit test: import java.math.BigDecimal; import java.text.DecimalFormat; import java.time.Duration; import javax.sql.DataSource; import io.github....
Peter Penzov's user avatar
  • 1,104
0 votes
1 answer
43 views

I have this class: package com.example.demo; import org.springframework.batch.core.Job; import org.springframework.batch.core.job.builder.JobBuilder; import org.springframework.batch.core....
hanene's user avatar
  • 3
0 votes
1 answer
75 views

I have a WAR deployed on WildFly that depends on a module where JUnit 5 JARs are located. I keep getting this exception: [Cannot create Launcher without at least one TestEngine; consider adding an ...
Pp88's user avatar
  • 1,103
1 vote
0 answers
26 views

I have a class Foo with generics. Inside class Foo, I have an interface declared Bar. public class Foo<T,U> { @Autowired private Bar<T, U> bar; public Mono<F> calculate(...
developersupport2025's user avatar
0 votes
1 answer
77 views

I'm writing a unit test in a Spring Boot application using Mockito and JUnit 5, and I'm trying to verify a method call where one of the parameters is a Map<String, String>. Here's the method ...
sam's user avatar
  • 1
1 vote
0 answers
368 views

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 ...
Seshen's user avatar
  • 11
0 votes
0 answers
52 views

Error in question: I have tried to uninstall and install again eclipse, uninstalled and installed the Junit 5 library, and Restart Eclipse By the way Im using Eclipse IDE for Java Developers Version: ...
José Juan Donoso Valle's user avatar
1 vote
1 answer
132 views

I have this Junit 5 test code: @InjectMocks ReportAssembler reportAssembler; private ReportingReturnResponse reportingReturnResponse; private ReturnReport returnReport; private StaticPathLinkBuilder ...
Peter Penzov's user avatar
  • 1,104
0 votes
0 answers
27 views

Context Consider a Junit 5 test suite with a maven-failsafe configuration that is configured to run the tests concurrently in multiple processes using the forkCount parameter. Question Is it possible ...
Tiddo's user avatar
  • 6,563
0 votes
1 answer
221 views

I have been trying to write a test using Mockito for my service layer, there are properties required to be loaded from the application-test.yml. The information is getting loaded in the repository ...
Akhilesh Sharma's user avatar
0 votes
1 answer
214 views

I want to mock a complex case of Java method response into JUnit 5 test which is using hateoas. The JUnit 5 test: @ExtendWith(MockitoExtension.class) public class ReportingATest { @Spy protected ...
Peter Penzov's user avatar
  • 1,104
0 votes
0 answers
33 views

I have this old JUnit code: import static org.codehaus.groovy.runtime.InvokerHelper.asList; import static org.mockito.Mockito.when; User user = new User (); .... when(calculate(any())) ....
Peter Penzov's user avatar
  • 1,104
0 votes
2 answers
131 views

i am trying to write a service's unit test, which tests the user login method with mockito and junit5. But some objects that should be mocked do not have its value. So it cause a NPE. this is the main ...
Sen Napbad's user avatar
0 votes
0 answers
53 views

The question is: Is it possible to use the steps implemented in another module? Currently, I have a core module with implemented steps (located in core.steps) and a project1 module (conditionally). In ...
Fill's user avatar
  • 1
0 votes
3 answers
3k views

I am trying to test Spring Boot's Rest controller. Problem: I am using @MockitoBean annotation for mocking the ContactService.java class. The Rest controller depends on this ContactService.java class. ...
Yousaf's user avatar
  • 29.5k
0 votes
0 answers
79 views

I have many Spock specifications like the next one, that act as "unit tests" for the resource classes of a project. This is an Open Liberty application and now there's a need to migrate it ...
Alex_Pap's user avatar
  • 546
0 votes
1 answer
105 views

I have a custom junit5 extension, that purpose is to do some clean up after each test class. I want it to be applied to all test classes in multi-module project automatically. Problem is when I enable ...
Retardust's user avatar
  • 301

1
2 3 4 5
77