-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26a6ab2
commit 8a28cae
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
lib/src/test/kotlin/foundation/esoteric/minecraft/plugins/library/item/TestTexturedItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foundation.esoteric.minecraft.plugins.library.item | ||
|
||
import foundation.esoteric.minecraft.plugins.library.TestPlugin | ||
import org.bukkit.Material | ||
|
||
class TestTexturedItem(plugin: TestPlugin) : TexturedItem(plugin, "test_textured_item", Material.MACE) |
33 changes: 33 additions & 0 deletions
33
lib/src/test/kotlin/foundation/esoteric/minecraft/plugins/library/item/TexturedItemTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package foundation.esoteric.minecraft.plugins.library.item | ||
|
||
import be.seeseemelk.mockbukkit.MockBukkit | ||
import foundation.esoteric.minecraft.plugins.library.TestPlugin | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class TexturedItemTest { | ||
|
||
private var plugin: TestPlugin? = null | ||
private var testItem: TestTexturedItem? = null | ||
|
||
@BeforeTest fun mockItemStack() { | ||
MockBukkit.mock() | ||
plugin = MockBukkit.load(TestPlugin::class.java) | ||
|
||
testItem = TestTexturedItem(plugin!!) | ||
} | ||
|
||
@Test fun usesCorrectModelData() { | ||
val item = testItem!!.createItem() | ||
|
||
assertEquals(testItem!!::class.qualifiedName, "foundation.esoteric.minecraft.plugins.library.item.TestTexturedItem") | ||
assertEquals(testItem!!::class.qualifiedName.hashCode(), "foundation.esoteric.minecraft.plugins.library.item.TestTexturedItem".hashCode()) | ||
assertEquals(item.itemMeta.customModelData, "foundation.esoteric.minecraft.plugins.library.item.TestTexturedItem".hashCode()) | ||
} | ||
|
||
@AfterTest fun unmockItemStack() { | ||
MockBukkit.unmock() | ||
} | ||
} |