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 {
|
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-handler:4.1.45.Final'
|
||||||
api 'io.netty:netty-codec: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'
|
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'
|
api 'com.github.jhg023:Pbbl:1.0.2'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/it.unimi.dsi/fastutil
|
// 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
|
// 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
|
// 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
|
// 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
|
// Logging
|
||||||
api group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3'
|
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.
|
||||||
// SLF4J is the base for logging so we can easily switch to any logging system later on.
|
api 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'
|
||||||
// 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'
|
|
||||||
|
|
||||||
api 'com.mojang:authlib:1.5.21'
|
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.ItemStack;
|
||||||
import net.minestom.server.item.Material;
|
import net.minestom.server.item.Material;
|
||||||
import net.minestom.server.utils.NamespaceID;
|
import net.minestom.server.utils.NamespaceID;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
@ -22,7 +22,7 @@ public class TestLootTables {
|
|||||||
|
|
||||||
private LootTableManager tableManager;
|
private LootTableManager tableManager;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void init() {
|
public void init() {
|
||||||
tableManager = new LootTableManager();
|
tableManager = new LootTableManager();
|
||||||
tableManager.registerConditionDeserializer(NamespaceID.from("minecraft:survives_explosion"), new SurvivesExplosionCondition.Deserializer());
|
tableManager.registerConditionDeserializer(NamespaceID.from("minecraft:survives_explosion"), new SurvivesExplosionCondition.Deserializer());
|
||||||
@ -53,42 +53,42 @@ public class TestLootTables {
|
|||||||
" ]\n" +
|
" ]\n" +
|
||||||
"}";
|
"}";
|
||||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"), new StringReader(lootTableJson));
|
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"), new StringReader(lootTableJson));
|
||||||
Assert.assertTrue(lootTable.getType() instanceof BlockType);
|
Assertions.assertTrue(lootTable.getType() instanceof BlockType);
|
||||||
Assert.assertEquals(1, lootTable.getPools().size());
|
Assertions.assertEquals(1, lootTable.getPools().size());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
Assertions.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.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||||
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
||||||
Assert.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
Assertions.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||||
Assert.assertEquals(0, entry.getFunctions().size());
|
Assertions.assertEquals(0, entry.getFunctions().size());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||||
Assert.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
Assertions.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadFromFile() throws FileNotFoundException {
|
public void loadFromFile() throws FileNotFoundException {
|
||||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||||
Assert.assertTrue(lootTable.getType() instanceof BlockType);
|
Assertions.assertTrue(lootTable.getType() instanceof BlockType);
|
||||||
Assert.assertEquals(1, lootTable.getPools().size());
|
Assertions.assertEquals(1, lootTable.getPools().size());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getMinRollCount());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getMaxRollCount());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getEntries().size());
|
||||||
Assert.assertTrue(lootTable.getPools().get(0).getEntries().get(0).getType() instanceof ItemType);
|
Assertions.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.getPools().get(0).getEntries().get(0) instanceof ItemEntry);
|
||||||
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
ItemEntry entry = (ItemEntry) lootTable.getPools().get(0).getEntries().get(0);
|
||||||
Assert.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
Assertions.assertEquals(Material.ACACIA_BUTTON, entry.getItem());
|
||||||
Assert.assertEquals(0, entry.getFunctions().size());
|
Assertions.assertEquals(0, entry.getFunctions().size());
|
||||||
Assert.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
Assertions.assertEquals(1, lootTable.getPools().get(0).getConditions().size());
|
||||||
Assert.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
Assertions.assertTrue(lootTable.getPools().get(0).getConditions().get(0) instanceof SurvivesExplosionCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void caching() throws FileNotFoundException {
|
public void caching() throws FileNotFoundException {
|
||||||
LootTable lootTable1 = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
LootTable lootTable1 = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||||
LootTable lootTable2 = 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
|
@Test
|
||||||
@ -96,8 +96,8 @@ public class TestLootTables {
|
|||||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/acacia_button"));
|
||||||
Data arguments = new Data();
|
Data arguments = new Data();
|
||||||
List<ItemStack> stacks = lootTable.generate(arguments);
|
List<ItemStack> stacks = lootTable.generate(arguments);
|
||||||
Assert.assertEquals(1, stacks.size());
|
Assertions.assertEquals(1, stacks.size());
|
||||||
Assert.assertEquals(Material.ACACIA_BUTTON, stacks.get(0).getMaterial());
|
Assertions.assertEquals(Material.ACACIA_BUTTON, stacks.get(0).getMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -107,7 +107,7 @@ public class TestLootTables {
|
|||||||
// negative value will force the condition to fail
|
// negative value will force the condition to fail
|
||||||
arguments.set("explosionPower", -1.0, Double.class);
|
arguments.set("explosionPower", -1.0, Double.class);
|
||||||
List<ItemStack> stacks = lootTable.generate(arguments);
|
List<ItemStack> stacks = lootTable.generate(arguments);
|
||||||
Assert.assertEquals(0, stacks.size());
|
Assertions.assertEquals(0, stacks.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -134,6 +134,6 @@ public class TestLootTables {
|
|||||||
"}";
|
"}";
|
||||||
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/none"), new StringReader(lootTableJson));
|
LootTable lootTable = tableManager.load(NamespaceID.from("blocks/none"), new StringReader(lootTableJson));
|
||||||
List<ItemStack> stacks = lootTable.generate(Data.EMPTY);
|
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.Tag;
|
||||||
import net.minestom.server.gamedata.tags.TagManager;
|
import net.minestom.server.gamedata.tags.TagManager;
|
||||||
import net.minestom.server.utils.NamespaceID;
|
import net.minestom.server.utils.NamespaceID;
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
@ -15,7 +15,7 @@ public class TestTags {
|
|||||||
|
|
||||||
private TagManager tags;
|
private TagManager tags;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void init() {
|
public void init() {
|
||||||
tags = new TagManager();
|
tags = new TagManager();
|
||||||
}
|
}
|
||||||
@ -36,13 +36,13 @@ public class TestTags {
|
|||||||
"\t\t\"minestom:some_other_item\"\n" +
|
"\t\t\"minestom:some_other_item\"\n" +
|
||||||
"\t]\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));
|
Tag loaded = tags.load(NamespaceID.from("minestom:test"), "any", new StringReader(tag2));
|
||||||
NamespaceID[] values = loaded.getValues().toArray(new NamespaceID[0]);
|
NamespaceID[] values = loaded.getValues().toArray(new NamespaceID[0]);
|
||||||
Assert.assertEquals(2, values.length);
|
Assertions.assertEquals(2, values.length);
|
||||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
Assertions.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.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\t\"minestom:some_other_item\"\n" +
|
||||||
"\t]\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));
|
Tag loaded = tags.forceLoad(NamespaceID.from("minestom:test"), "any", () -> new StringReader(tag2));
|
||||||
Assert.assertNotEquals(Tag.EMPTY, loaded);
|
Assertions.assertNotEquals(Tag.EMPTY, loaded);
|
||||||
Assert.assertEquals(1, loaded.getValues().size());
|
Assertions.assertEquals(1, loaded.getValues().size());
|
||||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||||
Assert.assertFalse(loaded.contains(NamespaceID.from("minestom:an_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\t\"minestom:some_other_item\"\n" +
|
||||||
"\t]\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));
|
Tag loaded = tags.forceLoad(NamespaceID.from("minestom:test"), "any", () -> new StringReader(tag2));
|
||||||
Assert.assertNotEquals(Tag.EMPTY, loaded);
|
Assertions.assertNotEquals(Tag.EMPTY, loaded);
|
||||||
Assert.assertEquals(2, loaded.getValues().size());
|
Assertions.assertEquals(2, loaded.getValues().size());
|
||||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:some_other_item")));
|
||||||
Assert.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
Assertions.assertTrue(loaded.contains(NamespaceID.from("minestom:an_item")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
tags = null;
|
tags = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user