Skip to content

Commit

Permalink
Remove some public keyword usage which are not required with Junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
theEvilReaper committed Nov 1, 2024
1 parent 5fd6895 commit 6031c8c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void entityPhysicsCheckCollision(Env env) {
}

@Test
public void entityPhysicsCheckShortDiagonal(Env env) {
void entityPhysicsCheckShortDiagonal(Env env) {
var instance = env.createFlatInstance();
instance.setBlock(0, 42, 1, Block.STONE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
import java.util.List;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.*;

@ExtendWith(MicrotusExtension.class)
public class PathfinderIntegrationTest {
class PathfinderIntegrationTest {

/**
* Validate that the path is valid
Expand All @@ -31,7 +30,7 @@ public class PathfinderIntegrationTest {
*/
private boolean validateNodes(List<PNode> nodes, Instance instance) {
if (nodes == null) fail("Path is null");
if (nodes.size() == 0) fail("Path is empty");
if (nodes.isEmpty()) fail("Path is empty");

nodes.forEach((node) -> {
if (instance.getBlock(node.blockX(), node.blockY(), node.blockZ()).isSolid()) {
Expand All @@ -43,7 +42,7 @@ private boolean validateNodes(List<PNode> nodes, Instance instance) {
}

@Test
public void testTall(Env env) {
void testTall(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand All @@ -66,7 +65,7 @@ public void testTall(Env env) {
}

@Test
public void testStraightLine(Env env) {
void testStraightLine(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand All @@ -86,7 +85,7 @@ public void testStraightLine(Env env) {
}

@Test
public void testShort(Env env) {
void testShort(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand All @@ -107,7 +106,7 @@ public void testShort(Env env) {
}

@Test
public void testBug(Env env) {
void testBug(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand All @@ -132,7 +131,7 @@ public void testBug(Env env) {
}

@Test
public void testPFNodeEqual(Env env) {
void testPFNodeEqual(Env env) {
PNode node1 = new PNode(new Pos(0.777, 0, 0), 2, 0, PNode.Type.WALK, null);
PNode node2 = new PNode(new Pos(0.777, 0, 0), 0, 3, PNode.Type.WALK, node1);

Expand All @@ -145,7 +144,7 @@ public void testPFNodeEqual(Env env) {
}

@Test
public void testStraightLineBlocked(Env env) {
void testStraightLineBlocked(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand Down Expand Up @@ -196,7 +195,7 @@ public void testStraightLineBlocked(Env env) {
}

@Test
public void testGravitySnap(Env env) {
void testGravitySnap(Env env) {
var i = env.createFlatInstance();

ChunkUtils.forChunksInRange(0, 0, 10, (x, z) -> {
Expand All @@ -208,6 +207,7 @@ public void testGravitySnap(Env env) {
var nodeGenerator = new GroundNodeGenerator();

var snapped = nodeGenerator.gravitySnap(i, -140.74433362614695, 40.58268292446131, 18.87966960447388, zombie.getBoundingBox(), 100);
assertTrue(snapped.isPresent());
assertEquals(40.0, snapped.getAsDouble());
}
}
4 changes: 2 additions & 2 deletions src/test/java/net/minestom/server/instance/BlockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void testShape() {
}

@Test
public void testDuplicateProperties() {
void testDuplicateProperties() {
HashSet<Integer> assignedStates = new HashSet<>();
for (Block block : Block.values()) {
for (Block blockWithState : block.possibleStates()) {
Expand All @@ -98,7 +98,7 @@ public void testDuplicateProperties() {
}

@Test
public void testStateIdConversion() {
void testStateIdConversion() {
for (Block block : Block.values()) {
for (Block blockWithState : block.possibleStates()) {
assertEquals(blockWithState, Block.fromStateId(blockWithState.stateId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
import static org.junit.jupiter.api.Assertions.assertNull;

@ExtendWith(MicrotusExtension.class)
public class AnvilLoaderIntegrationTest {
class AnvilLoaderIntegrationTest {

private static final Path testRoot = Path.of("src", "test", "resources", "net", "minestom", "server", "instance");

@Test
public void loadVanillaRegion(Env env) throws IOException {
void loadVanillaRegion(Env env) throws IOException {
// load a full vanilla region, not checking any content just making sure it loads without issues.

var worldFolder = extractWorld("anvil_vanilla_sample");
Expand All @@ -60,7 +60,7 @@ public boolean supportsParallelSaving() {
}

@Test
public void parallelSaveNonexistentFiles(Env env) throws Exception {
void parallelSaveNonexistentFiles(Env env) throws Exception {
var worldFolder = Files.createTempDirectory("minestom-test-world-parallel-save");
AnvilLoader chunkLoader = new AnvilLoader(worldFolder);
Instance instance = env.createFlatInstance(chunkLoader);
Expand All @@ -82,7 +82,7 @@ public void parallelSaveNonexistentFiles(Env env) throws Exception {
}

@Test
public void loadHouse(Env env) throws IOException {
void loadHouse(Env env) throws IOException {
// load a world that contains only a basic house and make sure it is loaded properly

var worldFolder = extractWorld("anvil_loader");
Expand Down Expand Up @@ -178,7 +178,7 @@ public boolean supportsParallelSaving() {
}

@Test
public void loadAndSaveChunk(Env env) throws IOException, InterruptedException {
void loadAndSaveChunk(Env env) throws IOException, InterruptedException {
var worldFolder = extractWorld("anvil_loader");
Instance instance = env.createFlatInstance(new AnvilLoader(worldFolder) {
// Force loads inside current thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@ExtendWith(MicrotusExtension.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class AbstractItemComponentTest<T> {
abstract class AbstractItemComponentTest<T> {

protected abstract @NotNull DataComponent<T> component();

Expand All @@ -34,7 +34,7 @@ public abstract class AbstractItemComponentTest<T> {

@ParameterizedTest(name = "{0}")
@MethodSource("directReadWriteMethodSource")
public void directReadWriteTest(String testName, @NotNull T entry, Env env) {
void directReadWriteTest(String testName, @NotNull T entry, Env env) {
var context = new BinaryTagSerializer.ContextWithRegistries(env.process());
if (component().isSerialized()) {
var written1 = component().write(context, entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
/**
* Ensures that packet can be written and read correctly.
*/
public class PacketWriteReadTest {
class PacketWriteReadTest {
private static final List<ServerPacket> SERVER_PACKETS = new ArrayList<>();
private static final List<ClientPacket> CLIENT_PACKETS = new ArrayList<>();

private static final Component COMPONENT = Component.text("Hey");
private static final Vec VEC = new Vec(5, 5, 5);

@BeforeAll
public static void setupServer() {
static void setupServer() {
// Handshake
SERVER_PACKETS.add(new ResponsePacket(new JsonObject().toString()));
// Status
Expand Down Expand Up @@ -156,7 +156,7 @@ public static void setupServer() {
}

@BeforeAll
public static void setupClient() {
static void setupClient() {
CLIENT_PACKETS.add(new ClientHandshakePacket(755, "localhost", 25565, ClientHandshakePacket.Intent.LOGIN));
}

Expand Down

0 comments on commit 6031c8c

Please sign in to comment.