mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add rename to null test
This commit is contained in:
parent
48cc28442d
commit
af84ba56f0
3 changed files with 43 additions and 4 deletions
|
|
@ -48,8 +48,8 @@ object ConfigOptions {
|
||||||
private const val KEY_ITEM = "item"
|
private const val KEY_ITEM = "item"
|
||||||
|
|
||||||
// Debug flag
|
// Debug flag
|
||||||
private const val DEBUG_LOGGING = "debug_log"
|
const val DEBUG_LOGGING = "debug_log"
|
||||||
private const val VERBOSE_DEBUG_LOGGING = "debug_log_verbose"
|
const val VERBOSE_DEBUG_LOGGING = "debug_log_verbose"
|
||||||
|
|
||||||
// ----------------------
|
// ----------------------
|
||||||
// Default config values
|
// Default config values
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
package xyz.alexcrea.cuanvil.anvil;
|
package xyz.alexcrea.cuanvil.anvil;
|
||||||
|
|
||||||
|
import io.delilaheve.util.ConfigOptions;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.AnvilInventory;
|
import org.bukkit.inventory.AnvilInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.Repairable;
|
import org.bukkit.inventory.meta.Repairable;
|
||||||
|
import org.eclipse.aether.util.ConfigUtils;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -32,8 +36,9 @@ public class AnvilFuseTests extends SharedCustomAnvilTest {
|
||||||
AnvilFuseTests.anvil = (AnvilInventory) anvil;
|
AnvilFuseTests.anvil = (AnvilInventory) anvil;
|
||||||
player.openInventory(anvil);
|
player.openInventory(anvil);
|
||||||
|
|
||||||
ConfigHolder.DEFAULT_CONFIG.getConfig().set("debug_log", true);
|
ConfigHolder.DEFAULT_CONFIG.getConfig().set(ConfigOptions.DEBUG_LOGGING, true);
|
||||||
ConfigHolder.DEFAULT_CONFIG.getConfig().set("debug_log_verbose", true);
|
ConfigHolder.DEFAULT_CONFIG.getConfig().set(ConfigOptions.VERBOSE_DEBUG_LOGGING, true);
|
||||||
|
ConfigHolder.DEFAULT_CONFIG.getConfig().set(ConfigOptions.ALLOW_COLOR_CODE, true); // For rename test
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
@ -100,4 +105,23 @@ public class AnvilFuseTests extends SharedCustomAnvilTest {
|
||||||
AnvilFuseTestUtil.executeAnvilTest(anvil, player, data);
|
AnvilFuseTestUtil.executeAnvilTest(anvil, player, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: currently anvil can only have null name. maybe handle differently later
|
||||||
|
@Test
|
||||||
|
public void nullNameResetTest(){
|
||||||
|
ItemStack base = new ItemStack(Material.NETHERITE_SWORD);
|
||||||
|
ItemStack expected = base.clone();
|
||||||
|
|
||||||
|
ItemMeta meta = expected.getItemMeta();
|
||||||
|
meta.displayName(Component.text("test"));
|
||||||
|
base.setItemMeta(meta);
|
||||||
|
|
||||||
|
AnvilFuseTestData data = new AnvilFuseTestData(
|
||||||
|
base, null,
|
||||||
|
expected, expected, null
|
||||||
|
// TODO add expected price
|
||||||
|
);
|
||||||
|
|
||||||
|
AnvilFuseTestUtil.executeAnvilTest(anvil, player, data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,19 @@ public record AnvilFuseTestData(
|
||||||
this(leftItem, rightItem, expectedResult, null
|
this(leftItem, rightItem, expectedResult, null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnvilFuseTestData(
|
||||||
|
@Nullable ItemStack leftItem,
|
||||||
|
@Nullable ItemStack rightItem,
|
||||||
|
@Nullable ItemStack expectedResult,
|
||||||
|
|
||||||
|
@Nullable ItemStack expectedAfterLeftPlaced,
|
||||||
|
@Nullable ItemStack expectedAfterRightPlaced
|
||||||
|
){
|
||||||
|
this(leftItem, rightItem,
|
||||||
|
expectedResult, expectedAfterLeftPlaced, expectedAfterRightPlaced,
|
||||||
|
null, null, null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue