mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Add test for both normal and colored seearches
This commit is contained in:
parent
d0963697ca
commit
e83c9f704e
@ -5,11 +5,14 @@ import java.util.function.Consumer;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -90,8 +93,28 @@ class TestGuideOpening {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Test if the Slimefun Search can be opened from the History")
|
@DisplayName("Test if the Slimefun Search works with normal and colored querys")
|
||||||
void testOpenSearch() throws InterruptedException {
|
void testOpenSearch() throws InterruptedException {
|
||||||
|
String normalQuery = "iron";
|
||||||
|
String coloredQuery = ChatColor.DARK_PURPLE + "iron";
|
||||||
|
|
||||||
|
SlimefunItem testItem = TestUtilities.mockSlimefunItem(plugin, "IRON_ITEM", new CustomItemStack(Material.IRON_INGOT, "iron item"));
|
||||||
|
testItem.register(plugin);
|
||||||
|
|
||||||
|
Player player = server.addPlayer();
|
||||||
|
PlayerProfile profile = TestUtilities.awaitProfile(player);
|
||||||
|
SlimefunGuideImplementation guide = new SurvivalSlimefunGuide(false, false);
|
||||||
|
|
||||||
|
guide.openSearch(profile, normalQuery, false);
|
||||||
|
Assertions.assertTrue(player.getOpenInventory().getTopInventory().contains(testItem.getItem()), "Failed on normal query");
|
||||||
|
|
||||||
|
guide.openSearch(profile, coloredQuery, false);
|
||||||
|
Assertions.assertTrue(player.getOpenInventory().getTopInventory().contains(testItem.getItem()), "Failed on colored query");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test if the Slimefun Search can be opened from the History")
|
||||||
|
void testOpenSearchHistory() throws InterruptedException {
|
||||||
String query = "electric";
|
String query = "electric";
|
||||||
|
|
||||||
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
|
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user