mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 12:07:42 +01:00
Merge pull request #13 from Articdive/update-dependencies
Update dependencies and JUnit
This commit is contained in:
commit
90e3a9ac3e
24
build.gradle
24
build.gradle
@ -35,8 +35,11 @@ sourceSets {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
// Junit Testing Framework
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
|
||||
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
|
||||
|
||||
// Netty
|
||||
api 'io.netty:netty-handler:4.1.45.Final'
|
||||
api 'io.netty:netty-codec:4.1.45.Final'
|
||||
implementation 'io.netty:netty-transport-native-epoll:4.1.45.Final:linux-x86_64'
|
||||
@ -44,23 +47,22 @@ dependencies {
|
||||
api 'com.github.jhg023:Pbbl:1.0.2'
|
||||
|
||||
// https://mvnrepository.com/artifact/it.unimi.dsi/fastutil
|
||||
api group: 'it.unimi.dsi', name: 'fastutil', version: '8.3.0'
|
||||
api 'it.unimi.dsi:fastutil:8.3.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||
api group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||
api 'com.google.code.gson:gson:2.8.6'
|
||||
|
||||
// Noise library for terrain generation
|
||||
// https://jitpack.io/#Articdive/Jnoise
|
||||
api 'com.github.Articdive:Jnoise:145c910a1e'
|
||||
api 'com.github.Articdive:Jnoise:1.0.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni
|
||||
api group: 'org.rocksdb', name: 'rocksdbjni', version: '6.8.1'
|
||||
api 'org.rocksdb:rocksdbjni:6.8.1'
|
||||
|
||||
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
|
||||
api group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3'
|
||||
|
||||
// SLF4J is the base for logging so we can easily switch to any logging system later on.
|
||||
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl
|
||||
api group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.13.3'
|
||||
// Logging
|
||||
api 'org.apache.logging.log4j:log4j-core:2.13.3'
|
||||
// SLF4J is the base logger for most libraries, therefore we can hook it into log4j2.
|
||||
api 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'
|
||||
|
||||
api 'com.mojang:authlib:1.5.21'
|
||||
|
||||
|
@ -10,9 +10,9 @@ import net.minestom.server.gamedata.loottables.tabletypes.BlockType;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.StringReader;
|
||||
@ -22,7 +22,7 @@ public class TestLootTables {
|
||||
|
||||
private LootTableManager tableManager;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
tableManager = new LootTableManager();
|
||||
tableManager.registerConditionDeserializer(NamespaceID.from("minecraft:survives_explosion"), new SurvivesExplosionCondition.Deserializer());
|
||||
@ -53,42 +53,42 @@ public class TestLootTables {
|
||||
" ]\n" +
|
||||
"}";
|
||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"), new StringReader(lootTableJson));
|
||||
Assert.assertTrue(lootTable.getType() instanceof BlockType);
|
||||
Assert.assertEquals(1, lootTable.getPools().size());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||
Assertions.assertTrue(lootTable.getType() instanceof BlockType);
|
||||
Assertions.assertEquals(1, lootTable.getPools().size());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
||||
Assert.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||
Assert.assertEquals(0, entry.getFunctions().size());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||
Assertions.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||
Assertions.assertEquals(0, entry.getFunctions().size());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadFromFile() throws FileNotFoundException {
|
||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||
Assert.assertTrue(lootTable.getType() instanceof BlockType);
|
||||
Assert.assertEquals(1, lootTable.getPools().size());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||
Assertions.assertTrue(lootTable.getType() instanceof BlockType);
|
||||
Assertions.assertEquals(1, lootTable.getPools().size());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
||||
Assert.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||
Assert.assertEquals(0, entry.getFunctions().size());
|
||||
Assert.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||
Assert.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||
Assertions.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||
Assertions.assertEquals(0, entry.getFunctions().size());
|
||||
Assertions.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||
Assertions.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void caching() throws FileNotFoundException {
|
||||
LootTable lootTable1 = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||
LootTable lootTable2 = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||
Assert.assertSame(lootTable1, lootTable2);
|
||||
Assertions.assertSame(lootTable1, lootTable2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -96,8 +96,8 @@ public class TestLootTables {
|
||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||
Data arguments = new Data();
|
||||
List<ItemStack> stacks = lootTable.generate(arguments);
|
||||
Assert.assertEquals(1, stacks.size());
|
||||
Assert.assertEquals(Material.ACACIA_BUTTON, stacks.get(0).getMaterial());
|
||||
Assertions.assertEquals(1, stacks.size());
|
||||
Assertions.assertEquals(Material.ACACIA_BUTTON, stacks.get(0).getMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -107,7 +107,7 @@ public class TestLootTables {
|
||||
// negative value will force the condition to fail
|
||||
arguments.set("explosionPower", -1.0, Double.class);
|
||||
List<ItemStack> stacks = lootTable.generate(arguments);
|
||||
Assert.assertEquals(0, stacks.size());
|
||||
Assertions.assertEquals(0, stacks.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -134,6 +134,6 @@ public class TestLootTables {
|
||||
"}";
|
||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/none"), new StringReader(lootTableJson));
|
||||
List<ItemStack> stacks = lootTable.generate(Data.EMPTY);
|
||||
Assert.assertEquals(0, stacks.size());
|
||||
Assertions.assertEquals(0, stacks.size());
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package tags;
|
||||
import net.minestom.server.gamedata.tags.Tag;
|
||||
import net.minestom.server.gamedata.tags.TagManager;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.StringReader;
|
||||
@ -15,7 +15,7 @@ public class TestTags {
|
||||
|
||||
private TagManager tags;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
tags = new TagManager();
|
||||
}
|
||||
@ -36,13 +36,13 @@ public class TestTags {
|
||||
"\t\t\"minestom:some_other_item\"\n" +
|
||||
"\t]\n" +
|
||||
"}";
|
||||
Assert.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test_sub"), "any", new StringReader(tag1)));
|
||||
Assertions.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test_sub"), "any", new StringReader(tag1)));
|
||||
Tag loaded = tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag2));
|
||||
NamespaceID[] values = loaded.getValues().toArray(new NamespaceID[0]);
|
||||
Assert.assertEquals(2, values.length);
|
||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assert.assertFalse(loaded.contains(NamespaceID.from("minestom:some_other_item_that_is_not_in_the_tag")));
|
||||
Assertions.assertEquals(2, values.length);
|
||||
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assertions.assertFalse(loaded.contains(NamespaceID.from("minestom:some_other_item_that_is_not_in_the_tag")));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,12 +63,12 @@ public class TestTags {
|
||||
"\t\t\"minestom:some_other_item\"\n" +
|
||||
"\t]\n" +
|
||||
"}";
|
||||
Assert.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag1)));
|
||||
Assertions.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag1)));
|
||||
Tag loaded = tags.forceLoad(NamespaceID.from("minestom:test"), "any", () -> new StringReader(tag2));
|
||||
Assert.assertNotEquals(Tag.EMPTY, loaded);
|
||||
Assert.assertEquals(1, loaded.getValues().size());
|
||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assert.assertFalse(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
Assertions.assertNotEquals(Tag.EMPTY, loaded);
|
||||
Assertions.assertEquals(1, loaded.getValues().size());
|
||||
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assertions.assertFalse(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,15 +89,15 @@ public class TestTags {
|
||||
"\t\t\"minestom:some_other_item\"\n" +
|
||||
"\t]\n" +
|
||||
"}";
|
||||
Assert.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag1)));
|
||||
Assertions.assertNotEquals(Tag.EMPTY, tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag1)));
|
||||
Tag loaded = tags.forceLoad(NamespaceID.from("minestom:test"), "any", () -> new StringReader(tag2));
|
||||
Assert.assertNotEquals(Tag.EMPTY, loaded);
|
||||
Assert.assertEquals(2, loaded.getValues().size());
|
||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
Assertions.assertNotEquals(Tag.EMPTY, loaded);
|
||||
Assertions.assertEquals(2, loaded.getValues().size());
|
||||
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void cleanup() {
|
||||
tags = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user