Questions tagged [junit-jupiter]

JUnit Jupiter is the combination of the new programming model and extension model for writing tests and extensions in JUnit 5.

Use the tag for questions that are specific to JUnit Jupiter.

Use the tag for all other questions related to features provided by JUnit 5 or migration to JUnit 5.

JUnit 5 Resources

263 questions
3
votes
0 answers

java.lang.NoClassDefFoundError: org/apache/maven/surefire/api/testset/TestSetFailedException while running Junit5

While running the Junit 5 test cases facing the below issue. CMD: $ mvn test -Dtest=com.app.AppTest -DskipTests=false (run only a specific test file, based on need and Jdk 1.8.0_232 with apache-maven-3.8.6 ) Error: [INFO] ---…
3
votes
1 answer

Maven does not find my test files that ends with "Test"?

I added the jupiter, mockito and jupiter-engine dependencies to the pom.xml file as you can see in the following clipboard:
stacktrace2234
  • 1,172
  • 1
  • 12
  • 22
3
votes
0 answers

Junit 5 how to use extensions with a test suite

I have cucumber tests which I execute with a Junit 5 suite. The Cucumber tests are all executed, but the extensions are ignored. The class to run the cucumber tests looks like this: import cucumber.Extensions.TestExtension; import…
der2te
  • 43
  • 2
3
votes
1 answer

Test Hangs at "Instantiating tests..." for 20 seconds using Gradle

I am running a test using Gradle and it says "Instantiating tests..." for about 20 seconds before actually running the test. How can I avoid this? I am using Quarkus 2.2.3.Final, and gradle-7.2. My test class: class OrganizationServiceImplTest { …
Ethan Miller
  • 361
  • 2
  • 13
3
votes
1 answer

Flag test as expected to fail in unit 5

I have a unit test, written with JUnit 5 (Jupiter), that is failing. I do not currently have time to fix the problem, so I would like to mark the test as an expected failure. Is there a way to do that? I see @Disable which causes the test to not…
Troy Daniels
  • 3,270
  • 2
  • 25
  • 57
3
votes
1 answer

QuarkusTest Access Beans in JUnit5 Extension

I have @QuarkusTest based test class. And I want to implement a JUnit 5 extension (BeforeEachCallback, AfterEachCallback) that interacts with a specific bean of my Quarkus test context. I tried CDI.current(), but that results into:…
Philipp Li
  • 499
  • 6
  • 22
3
votes
2 answers

How do I install Tensorflow 2.4.0?

Noob question. Thanks for bearing with me. I have Tensorflow 2.4.1 installed on my computer, but I need 2.4.0 version for compatibility with a specific project. I tried the following without success: conda install tensorflow==2.4.0 conda install -c…
Jim O.
  • 1,091
  • 12
  • 31
3
votes
1 answer

Can/Should Jupiter Extensions be used in custom JUnit5 engines?

May I ask what is the recommendation for Extension support in custom JUnit5 TestEngine? Since extensions come from junit-jupiter-api (and not junit platform) is it a bad idea to try and support them in custom engines? (And is there some easy way to…
3
votes
1 answer

Android Studio Arctic Fox incompatible with JUnit4?

Upgrading your Android Studio to Arctic Fox will cause you to go back and make adjustments to your build as documented here: Junit5 testSuite with SelectClasses not working in android unit test Does that mean I have to adjust all my unit tests from…
Lance Kind
  • 949
  • 12
  • 32
3
votes
3 answers

How to test with mockito a method that is running an async thread

I have the following code which I want to test: @Slf4j @Component public class DispatcherTask { private final MyClassService myClassService; private final SreamingService streamingService; private ExecutorService executor =…
3
votes
0 answers

How to execute parameterized runs of a test method sequentially in a parallelized Junit 5 test class?

Given the following Junit5 test class, how do I run upperCaseTest and lowerCaseTest in parallel while the parameterized runs within each test method run in sequence. In other words, "A", "B" and "C" should run in sequence, "x", "y", "z" should run…
3
votes
3 answers

java.lang.ExceptionInInitializerError when trying to mock

I'm running into this issue when trying to mock an object of the interface org.springframework.ui.Model. I'm using Mockito 3.5.15 w/Java 8 and JUnit Jupiter. I've tried using both @Mock and Mockito.mock(), globally and inside a method, but get the…
vnavs
  • 51
  • 1
  • 1
  • 8
3
votes
1 answer

Constraint violation when reading data

I am writing integration tests with junit-jupiter and something very strange is happening -> Constraint violation exception occurs when I am reading (not saving the data) storesTemplateRepository.findByCountryOrderByTemplateName(country, pageable);…
stefan.stt
  • 2,357
  • 5
  • 24
  • 47
3
votes
1 answer

Kotlin MockK: io.mockk.MockKException: no answer found for

This is my code snippet: @Test fun `request should return anon id if query param present`(@MockK(relaxed = true) req: ServerRequest) I'm using JUnit5(Jupiter). The exception I've got is: io.mockk.MockKException: no answer found for:…
yuranos
  • 8,799
  • 9
  • 56
  • 65
3
votes
3 answers

Gradle&Junit5 Tag based Gradle task doesn't work when using & expression

I use next gradle task configuration task pipelineTest(type: Test) { Test task -> task.useJUnitPlatform { org.gradle.api.tasks.testing.junitplatform.JUnitPlatformOptions options -> options.includeTags 'integration-test & fast' } I expect that…
1 2
3
17 18