Skip to content

Commit

Permalink
Add resource pack zip file test
Browse files Browse the repository at this point in the history
  • Loading branch information
EsotericEnderman committed Nov 1, 2024
1 parent 8782752 commit f0adda7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import foundation.esoteric.minecraft.plugins.library.file.FileManagedPlugin
import foundation.esoteric.minecraft.plugins.library.file.FileManager
import foundation.esoteric.minecraft.plugins.library.item.CustomItemManager
import foundation.esoteric.minecraft.plugins.library.item.CustomItemPlugin
import foundation.esoteric.minecraft.plugins.library.pack.resource.ResourcePackManager
import foundation.esoteric.minecraft.plugins.library.pack.resource.ResourcePackPlugin
import org.bukkit.plugin.java.JavaPlugin

open class TestPlugin : JavaPlugin(), FileManagedPlugin, CustomItemPlugin {
open class TestPlugin : JavaPlugin(), FileManagedPlugin, CustomItemPlugin, ResourcePackPlugin {

override lateinit var resourcePackManager: ResourcePackManager
override lateinit var customItemManager: CustomItemManager
override lateinit var fileManager: FileManager

override fun onEnable() {
fileManager = FileManager(this)
customItemManager = CustomItemManager(this)
resourcePackManager = ResourcePackManager(this)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package foundation.esoteric.minecraft.plugins.library.pack.resource

import be.seeseemelk.mockbukkit.MockBukkit
import foundation.esoteric.minecraft.plugins.library.TestPlugin
import java.io.File
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertTrue

class ResourcePackTest {

private var plugin: TestPlugin? = null

@BeforeTest fun mockResourcePackPlugin() {
MockBukkit.mock()
plugin = MockBukkit.load(TestPlugin::class.java)
}

@Test fun resourcePackSavingWorks() {
val resourcePackFolder = File(plugin!!.dataFolder, "TestPluginResourcePack.zip")
assertTrue(resourcePackFolder.exists())
}

@AfterTest fun unmockResourcePackPlugin() {
MockBukkit.unmock()
}
}

0 comments on commit f0adda7

Please sign in to comment.