mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[Ci skip] Added some more basic tests
This commit is contained in:
parent
1b951f77ea
commit
4af26f3b00
@ -44,6 +44,14 @@ public interface SlimefunGuideImplementation {
|
||||
*/
|
||||
ItemStack getItem();
|
||||
|
||||
/**
|
||||
* This method returns whether this {@link SlimefunGuideImplementation} is meant
|
||||
* for Survival Mode.
|
||||
*
|
||||
* @return Whether this is a survival mode implementation
|
||||
*/
|
||||
boolean isSurvivalMode();
|
||||
|
||||
void openMainMenu(PlayerProfile profile, int page);
|
||||
|
||||
void openCategory(PlayerProfile profile, Category category, int page);
|
||||
|
@ -42,6 +42,11 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return SlimefunGuideLayout.BOOK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSurvivalMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
return new CustomItem(new ItemStack(Material.ENCHANTED_BOOK), "&aSlimefun Guide &7(Book GUI)", "", "&eRight Click &8\u21E8 &7Browse Items", "&eShift + Right Click &8\u21E8 &7Open Settings / Credits");
|
||||
|
@ -14,7 +14,7 @@ public class CheatSheetSlimefunGuide extends ChestSlimefunGuide {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSurvivalMode() {
|
||||
public boolean isSurvivalMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,8 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
return new CustomItem(new ItemStack(Material.ENCHANTED_BOOK), "&aSlimefun Guide &7(Chest GUI)", "", "&eRight Click &8\u21E8 &7Browse Items", "&eShift + Right Click &8\u21E8 &7Open Settings / Credits");
|
||||
}
|
||||
|
||||
protected boolean isSurvivalMode() {
|
||||
@Override
|
||||
public boolean isSurvivalMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package io.github.thebusybiscuit.slimefun4.tests.guide;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
public class TestBookSlimefunGuide {
|
||||
|
||||
@BeforeAll
|
||||
public static void load() {
|
||||
MockBukkit.mock();
|
||||
MockBukkit.load(SlimefunPlugin.class);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void unload() {
|
||||
MockBukkit.unmock();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicGetters() {
|
||||
BookSlimefunGuide guide = new BookSlimefunGuide();
|
||||
|
||||
Assertions.assertEquals(SlimefunGuideLayout.BOOK, guide.getLayout());
|
||||
Assertions.assertTrue(guide.isSurvivalMode());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package io.github.thebusybiscuit.slimefun4.tests.guide;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
public class TestChestSlimefunGuide {
|
||||
|
||||
@BeforeAll
|
||||
public static void load() {
|
||||
MockBukkit.mock();
|
||||
MockBukkit.load(SlimefunPlugin.class);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void unload() {
|
||||
MockBukkit.unmock();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicGetters() {
|
||||
ChestSlimefunGuide guide = new ChestSlimefunGuide(false);
|
||||
|
||||
Assertions.assertEquals(SlimefunGuideLayout.CHEST, guide.getLayout());
|
||||
Assertions.assertTrue(guide.isSurvivalMode());
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.tests.services;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@ -12,7 +11,6 @@ import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.UpdaterService;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import org.mockito.Mock;
|
||||
|
||||
public class TestUpdaterService {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user