Fix unittest not running with mvn build

This commit is contained in:
aletta.codes 2022-03-22 20:43:14 +01:00
parent d83aa3ca8c
commit 9536fcdc69
2 changed files with 8 additions and 4 deletions

View File

@ -20,7 +20,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version> <version>${junit.jupiter.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -37,8 +37,10 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${maven.maven-surefire-plugin.version}</version> <!-- JUnit 5 requires Surefire version 2.22.0 or higher -->
<version>2.22.0</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -1,12 +1,14 @@
package com.gildedrose; package com.gildedrose;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@TestInstance(Lifecycle.PER_CLASS)
class GildedRoseTest { public class GildedRoseTest {
GildedRose app; GildedRose app;