diff options
author | nea <nea@nea.moe> | 2023-08-06 23:03:06 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-08-07 00:53:31 +0200 |
commit | 1da07465b60a8e357373d7c3a3f764dfa4d5960b (patch) | |
tree | bc94e3caa665223ef273e6166c3d9746af23970a /src/test | |
parent | fa464f1d1eef4e1d320c47350fe6ded16b36b3ed (diff) | |
download | skyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.tar.gz skyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.tar.bz2 skyhanni-1da07465b60a8e357373d7c3a3f764dfa4d5960b.zip |
Basic test for dungeon items
Diffstat (limited to 'src/test')
4 files changed, 60 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 diff --git a/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension new file mode 100644 index 000000000..5b7b6dd31 --- /dev/null +++ b/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension @@ -0,0 +1 @@ +at.hannibal2.skyhanni.test.BootstrapHook diff --git a/src/test/resources/testdata/Item/10starnecronhead.json b/src/test/resources/testdata/Item/10starnecronhead.json new file mode 100644 index 000000000..1e5bbe7b0 --- /dev/null +++ b/src/test/resources/testdata/Item/10starnecronhead.json @@ -0,0 +1 @@ +{"type":"Item","data":"H4sIA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