aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/at/hannibal2/skyhanni')
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt30
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/ItemModifierTest.kt28
2 files changed, 58 insertions, 0 deletions
diff --git a/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt b/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt
new file mode 100644
index 000000000..3aff72c2b
--- /dev/null
+++ b/src/test/java/at/hannibal2/skyhanni/test/BootstrapHook.kt
@@ -0,0 +1,30 @@
+package at.hannibal2.skyhanni.test
+
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible
+import net.minecraft.block.Block
+import net.minecraft.block.BlockFire
+import net.minecraft.init.Bootstrap
+import net.minecraft.item.Item
+import org.junit.jupiter.api.extension.BeforeAllCallback
+import org.junit.jupiter.api.extension.Extension
+import org.junit.jupiter.api.extension.ExtensionContext
+import java.util.concurrent.locks.Lock
+import java.util.concurrent.locks.ReentrantLock
+
+class BootstrapHook : BeforeAllCallback, Extension {
+ companion object {
+ private val LOCK: Lock = ReentrantLock()
+ }
+
+ override fun beforeAll(p0: ExtensionContext?) {
+ LOCK.lock()
+ try {
+ Bootstrap::class.java.getDeclaredField("alreadyRegistered").makeAccessible().set(null, true)
+ Block.registerBlocks()
+ BlockFire.init()
+ Item.registerItems()
+ } finally {
+ LOCK.unlock()
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/java/at/hannibal2/skyhanni/test/ItemModifierTest.kt b/src/test/java/at/hannibal2/skyhanni/test/ItemModifierTest.kt
new file mode 100644
index 000000000..0fc172230
--- /dev/null
+++ b/src/test/java/at/hannibal2/skyhanni/test/ItemModifierTest.kt
@@ -0,0 +1,28 @@
+package at.hannibal2.skyhanni.test
+
+import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getDungeonStarCount
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getHotPotatoCount
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemUuid
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasArtOfPeace
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated
+import org.junit.jupiter.api.Test
+
+class ItemModifierTest {
+
+
+ @Test
+ fun testUpgradeLevelMasterStars() {
+ val itemStack = TestExportTools.getTestData(TestExportTools.Item, "10starnecronhead")
+ assert(!itemStack.isRecombobulated())
+ assert(itemStack.getReforgeName() == "ancient")
+ assert(itemStack.getItemUuid() == "2810b7fe-33af-4dab-bb41-b4815f5847af")
+ assert(itemStack.isEnchanted())
+ assert(itemStack.getHotPotatoCount() == 15)
+ assert(itemStack.getEnchantments()?.size == 11)
+ assert(itemStack.hasArtOfPeace())
+ assert(itemStack.getDungeonStarCount() == 10)
+ }
+} \ No newline at end of file