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
1
vote
2 answers

LocalStack TestContainer unable to match logs using WaitForLog

I'm trying to start a localstack container, this container launches a script at startup to initialize an S3 bucket, a SQS queue and a DynamoDB Table with a GSI. Here I'm using a waitStrategy Wait.forLogMessage But the regex never catches the…
zouroto
  • 155
  • 5
  • 14
1
vote
1 answer

How can I insert and get data from a collection of java objects to be able to create a parameterized method?

The form "inputConditionsTest[0]" is incorrect.How can I get the first values of my collection ??? public class ControllaCondizioniParamTest { private ControllaCondizioni controllaCondizioni; public static Collection
1
vote
0 answers

BDD : Test using Sclatest - AnyFlatSpec and Junit 5 not detected

I'm using : scala 2.12.15 Java 17 scalatest_2.12:3.2.15 JUnit 5 Gradle With this very simple codes in my test folder: import org.scalatest.flatspec.AnyFlatSpec class MyTestSpec extends AnyFlatSpec { "An empty Set" should "have size 0" in { …
1
vote
1 answer

Bean serialization issue while running test case

when hit the endpoint from the browser it is working fine but test case failing. please find the code below: Controller class: @RestController public class EmployeeController { @Autowired private EmployeeDTO employeeDTO; …
ts009
  • 13
  • 3
1
vote
1 answer

order execution of Junit5 tests by launcher / engine

I have a Spring Boot 2.5.4 project with some @SpringBootTest tests and some @Cucumber tests. I am using gradle to build. I have noticed that my build is failing depending on where it's executed, and I found that it actually depended on the order the…
Vincent F
  • 6,523
  • 7
  • 37
  • 79
1
vote
1 answer

Junit BeforeAll or BeforeEach - when to initialise class under test if state does not change between tests?

In my following example I am unsure if I should use BeforeEach or BeforeAll - Note the class under test Calculator does not change state etc between tests so I assumed making it static and using BeforeEach is more efficient? public class…
java12399900
  • 1,485
  • 7
  • 26
  • 56
1
vote
1 answer

Having challenges installing pandoc-crossref in windows

I have recently started using r markdown and I am having issues with installing pandoc-crossref in window. I have tried approaching friends on getting the set-up but to no avail. I have tried searching on the web but couldn't find anything useful. I…
wananchi
  • 23
  • 4
1
vote
1 answer

How to configure IntelliJ and hibernate-jpamodelgen annotations to launch test class from the IDE

We have a git multimodules projects MAVEN on IntelliJ. We use hibernate-jpamodelgen for criteria builder API. We have web project using maven dependency entities library which are generating annotated class in entities => target folder. When…
cyril
  • 872
  • 6
  • 29
1
vote
0 answers

Using @DataJpaTest in Spring Boot 3.0.0 Integration test causes Test discovery error

Whenever I add @DataJpaTest to a test test execution fails with the following error: import com.owino.paginateddata.entities.Tweet; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import…
1
vote
0 answers

Spring application with EmptyInterceptor no longer calling `onSave` or `onFlushDirty` in tests

We have a Spring Boot 2.4.5 application that uses a custom EmptyInterceptor. This interceptor is working in both the application and the tests where both the onSave and onFlushDirty methods are being executed properly. We just updated to Boot which…
Chris Williams
  • 11,647
  • 15
  • 60
  • 97
1
vote
0 answers

Java's LocalDateTime field doesn't match precision in JUnit test

I have some unit tests that run fine under Java 11.x and a Docker container with PostgreSQL 12.x. I'm in the process of migrating the application into Java 17.x, and now there are several of these unit tests failing. As far as I can tell the issue…
x80486
  • 6,627
  • 5
  • 52
  • 111
1
vote
2 answers

Upgrade from SpringBoot 2.6 -> 2.7 - No qualifying bean of type 'org.springframework.boot....TestEntityManager' available

I updated from SpringBoot 2.6.12 to 2.7.11 and as a consequence our RepositoryTests were not working anymore. The @autowired TestEntityManager can't be filled by a qualifying bean after the upgrade. I tried a lot of solutions from other threads and…
1
vote
1 answer

quarkus test with multiple databases

I need to run my Quarkus Tests against multiple different databases. Right now I write an abstract class with the tests and for each database a class that inherits this class…
Jens Popp
  • 131
  • 1
  • 12
1
vote
1 answer

TestEngine with ID 'junit-jupiter' failed to discover tests while debugging

I noticed that problem with Junit5 when I'm trying to debug the code. Anyone faced that issue? I've tried to change the version etc but nothing has helped. My pom.xml: 18
Philip_CA
  • 103
  • 6
1
vote
1 answer

Junit5 - Run tests in a @Suite with @IncludeTags in a specific and consistent run order

I'm trying to find a way to control the order of tests executed in a suite which includes one or more @Tags Example: @Suite @SelectPackages("com.tests") @IncludeTags({ "Tag1", "Tag2", }) public class TestSuite {…
bpd00
  • 31
  • 4