Skip to content

Commit 06cd71f

Browse files
Update Minestom to 1.21.5 (#16)
* Update to the latest release of Minestom * Add junit to the test dependencies * Add integration the for the custom player implementation * Upgrade Minestom # Conflicts: # settings.gradle.kts * Migrate to the new versioning schema from Minestom
1 parent 7f7477b commit 06cd71f

3 files changed

Lines changed: 52 additions & 5 deletions

File tree

build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
java
3+
jacoco
34
`java-library`
45
`maven-publish`
56
}
@@ -17,13 +18,26 @@ dependencies {
1718
api(libs.minestom)
1819
compileOnly(libs.junit.params)
1920
compileOnly(libs.junit.api)
21+
22+
testImplementation(libs.junit.api)
23+
testImplementation(libs.junit.params)
24+
testImplementation(libs.junit.platform.launcher)
25+
testRuntimeOnly(libs.junit.engine)
2026
}
2127

2228
tasks {
2329
compileJava {
2430
options.encoding = "UTF-8"
2531
options.release.set(21)
2632
}
33+
34+
test {
35+
useJUnitPlatform()
36+
jvmArgs("-Dminestom.inside-test=true")
37+
testLogging {
38+
events("passed", "skipped", "failed")
39+
}
40+
}
2741
}
2842

2943
publishing {

settings.gradle.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ dependencyResolutionManagement {
77

88
versionCatalogs {
99
create("libs") {
10-
version("minestom", "a1d1920a04")
11-
version("junit-jupiter", "5.13.2")
10+
version("minestom", "2025.07.03-1.21.5")
11+
version("junit", "5.13.2")
12+
version("junit.platform", "1.13.1")
1213

13-
library("minestom","net.minestom", "minestom-snapshots").versionRef("minestom")
14+
library("minestom","net.minestom", "minestom").versionRef("minestom")
15+
16+
library("junit.api", "org.junit.jupiter", "junit-jupiter-api").versionRef("junit")
17+
library("junit.params", "org.junit.jupiter", "junit-jupiter-params").versionRef("junit")
18+
library("junit.engine", "org.junit.jupiter", "junit-jupiter-engine").versionRef("junit")
19+
library("junit.platform.launcher", "org.junit.platform", "junit-platform-launcher").versionRef("junit.platform")
1420

15-
library("junit-api", "org.junit.jupiter", "junit-jupiter-api").versionRef("junit-jupiter")
16-
library("junit-params", "org.junit.jupiter", "junit-jupiter-params").versionRef("junit-jupiter")
1721
}
1822
}
1923
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package net.minestom.testing;
2+
3+
import net.minestom.server.coordinate.Pos;
4+
import net.minestom.server.entity.Player;
5+
import net.minestom.server.instance.Instance;
6+
import net.minestom.testing.extension.MicrotusExtension;
7+
import org.jetbrains.annotations.NotNull;
8+
import org.junit.jupiter.api.Test;
9+
import org.junit.jupiter.api.extension.ExtendWith;
10+
11+
import static org.junit.jupiter.api.Assertions.*;
12+
13+
@ExtendWith(MicrotusExtension.class)
14+
class TestPlayerIntegrationTest {
15+
16+
@Test
17+
void testCustomPlayerCreation(@NotNull Env env) {
18+
Instance instance = env.createFlatInstance();
19+
assertNotNull(instance);
20+
Player player = env.createPlayer(instance);
21+
assertNotNull(player, "Player should not be null after creation");
22+
assertInstanceOf(Player.class, player, "Player should be an instance of Player class");
23+
assertInstanceOf(TestPlayerImpl.class, player, "Player should be an instance of TestPlayerImpl class");
24+
assertEquals(instance, player.getInstance(), "Player should be in the created instance");
25+
assertEquals(Pos.ZERO, player.getPosition(), "Player should start at position (0, 0, 0)");
26+
assertEquals("RandName", player.getUsername(), "Player should have a random name");
27+
}
28+
29+
}

0 commit comments

Comments
 (0)