Questions tagged [junit-jupiter]

1

votes
1

answer
386

Views

Java JUnit 5 annotations differences

I see there was introduced the new JUnit Jupiter according to JUnit 5 User Guide. JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage I am confused about the same-named annotations I use across the library. Is there any significant difference between these two ones? org.junit.Test org.junit.jup...
Nikolas
1

votes
1

answer
1k

Views

java.lang.NoSuchMethodError: org.junit.platform.launcher.Launcher.execute

I'm trying to run the following example unit test case class ExampleUnitTest { @Test fun addition_is_Correct() { assertEquals(4, (2 + 2).toLong()) } } but I get the following exception Exception in thread 'main' java.lang.NoSuchMethodError: org.junit.platform.launcher.Launcher.execute(Lorg/junit/pla...
kokilayaa
1

votes
0

answer
202

Views

@DisplayName not working when tests executed through maven

JUnit5 tests results are not showing the specified @DisplayName when executed through maven. The same test suites show correctly assigned names when run under eclipse (right-click --> Run as... --> JUnit Test). This is an example of implemented tests: @DisplayName(value='prog QA suite') public class...
ilikeblues
1

votes
1

answer
629

Views

How can I change the TestEngine ID to run JUnit 5?

I have the following dependencies for my Kotlin Android project { dependencies { ... testImplementation 'org.junit.platform:junit-platform-engine:1.0.2' testImplementation 'org.junit.platform:junit-platform-gradle-plugin:1.0.2' testImplementation 'org.junit.platform:junit-platform-launcher:1.0.2' te...
ShrimpCrackers
1

votes
2

answer
0

Views

How to deal with ExecutionCondition if i want to disable test, if some annotation present below the test method?

Currently trying JUnit five and want to implement into my automation framework possibility skip tests if my custom annotation present. If im trying to do like: public class KnownIssueExtension implements ExecutionCondition { @Override public ConditionEvaluationResult evaluateExecutionCondition(Exten...
Akhmad Sadaiev
1

votes
1

answer
0

Views

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: ServerRequest(#1).cookies() This is weird because if I understood r...
yuranos87
1

votes
1

answer
0

Views

Redefine template used to create a JUnit 5 class via “Create test” feature of IntelliJ 2019

The menu item Code > Generate… > Test… displays this dialog box. …and produces a method like this in the resulting test class: @Test void fromDuration () { } I want the @DisplayName annotation (new in JUnit 5) to be automatically inserted as well, for each test method being generated. Like thi...
Basil Bourque
1

votes
1

answer
0

Views

java.lang.NoSuchMethodError: Lorg/junit/platform/commons/function/Try;

I want to use the latest JUnit version: org.junit.jupiter junit-jupiter-engine 5.4.0 test org.junit.jupiter junit-jupiter-api 5.4.0 test org.mockito mockito-core 2.25.0 test org.springframework.boot spring-boot-starter-test 2.1.3.RELEASE test org.junit.jupiter junit-jupiter-params 5.4.0 test But whe...
Peter Penzov
1

votes
2

answer
721

Views

Spring REST docs: How to migrate Rule to JUnit 5

I migrated my Spring tests to JUnit 5, and they work fine. However, I don't know how to migrate @Rule public JUnitRestDocumentation restDocumentation = .... Any hint is appreciated.
Juergen Zimmermann
1

votes
1

answer
342

Views

how to fix “The import org.junit.jupiter”?

I'm working on MMU project and I don't know how to fix this error on @Test annotation. How I can fix it? I have added JUnit library but that's not working.
user5377037
1

votes
1

answer
88

Views

java.lang.IncompatibleClassChangeError org.junit.jupiter.params.provider.Arguments must be InterfaceMethodref constant

import groovy.transform.CompileStatic import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import java.util.stream.Stream import static org.assertj.core.api.Assertions.assertThat @CompileStatic clas...
Anna Ira Hurnaus
1

votes
1

answer
69

Views

Use enum values as a Tag in JUnit 5

I like the new @Tag feature in JUnit 5 as shown in the manual. I have one concern. The tag values are mere strings. That means typos might happen. ➥ Is there some way to get the tag behavior but using values from an enum(s) that I define? Or some other way I can depend on the compiler to enforc...
Basil Bourque
3

votes
1

answer
4.1k

Views

IntelliJ + JUnit 5 (Jupiter)

My build.gradle has: testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0' Using the standard example from http://junit.org/junit5/docs/current/user-guide/ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; class FirstJUnit5Tests { @Test void myFirstTes...
clay
1

votes
1

answer
286

Views

JUnit 5 Gradle: Do test classes really have to be suffixed with “Test(s)”?

It appears as if JUnit 5 tests aren't found if the file- and class name does not end with 'Test' or 'Tests' when using Gradle. Is it possible to configure Gradle to treat everything in the test directory as test classes?
Filip Allberg
1

votes
1

answer
78

Views

junit-jupiter-engine v5.0.1 not working with eclipse Oxygen.3a Release (4.7.3a)

I stumbled upon this exception while running a junit test class (versions in question title). As i have read in this thread that i must upgrade to eclipse Oxygen.3, i did it but still have the same exception thrown.
marsouf
2

votes
2

answer
1.6k

Views

TensorFlow installation denied due to user permissions

I tried to run tensorflow on Jupiter netbook, python 2.7 but I realized it requiered 3.6 pythong version so I followed this steps : Installing with Anaconda Create a conda environment named tensorflow by invoking the following command: C:> conda create -n tensorflow pip python=3.5 Activate the conda...
idan
80

votes
8

answer
64.9k

Views

JUnit 5: How to assert an exception is thrown?

Is there a better way to assert that a method throws an exception in JUnit 5? Currently, I have to use an @Rule in order to verify that my test throws an exception, but this doesn't work for the cases where I expect multiple methods to throw exceptions in my test.
steventrouble
2

votes
2

answer
42

Views

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 test that have both tags integration-test and fast will b...
Vivien Miller