aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-06 23:03:06 +0200
committerhannibal2 <24389977+hannibal002@users.noreply.github.com>2023-08-07 00:53:31 +0200
commit1da07465b60a8e357373d7c3a3f764dfa4d5960b (patch)
treebc94e3caa665223ef273e6166c3d9746af23970a /src/test/java/at
parentfa464f1d1eef4e1d320c47350fe6ded16b36b3ed (diff)
downloadskyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.tar.gz
skyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.tar.bz2
skyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.zip
Basic test for dungeon items
Diffstat (limited to 'src/test/java/at')
-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