test: add JUnit 5 harness
This commit is contained in:
@@ -22,6 +22,21 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- The BOM keeps the jupiter engine and the platform launcher on matching
|
||||
versions. Left to transitive resolution they drift apart, and a mismatched
|
||||
launcher fails to discover tests rather than failing the build. -->
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.11.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
@@ -29,6 +44,12 @@
|
||||
<version>26.2.build.92-stable</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<!-- Version comes from junit-bom above. -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -39,5 +60,15 @@
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<!-- Pinned because the version Maven bundles by default decides whether JUnit 5
|
||||
tests are discovered at all. An older default would skip the whole suite and
|
||||
still report BUILD SUCCESS, which is the one failure this project can't see. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.5.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package dev.marcospaulo.canalhandia;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Guards the test harness itself. The rest of the suite is written test-first, so
|
||||
* a silently broken harness (surefire not discovering JUnit 5, wrong JDK) would
|
||||
* read as "all tests pass" instead of "no tests ran". This one is here to fail loudly.
|
||||
*/
|
||||
class SanityTest {
|
||||
|
||||
@Test
|
||||
void harnessRuns() {
|
||||
assertEquals(2, 1 + 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user