Skip to content

Commit

Permalink
upgrade mockbukkit to 4.9.3 and fix some broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrea committed Dec 4, 2024
1 parent 70767ae commit 6f2b15a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies {
implementation(kotlin("stdlib"))

// Test dependency
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.5.0")
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.9.3") //lower bound: 4.9.2 upper bound: 4.9.3
testRuntimeOnly("commons-lang:commons-lang:2.6")
}

Expand Down
17 changes: 14 additions & 3 deletions src/test/java/xyz/alexcrea/cuanvil/anvil/AnvilFuseTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.Repairable;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -49,11 +51,15 @@ public static void tearDown() {
public void mergeFuseTest(){
// Literally just test a sharpness 4 + sharpness 4
ItemStack sharpness4 = CommonItemUtil.sharpness(4);
ItemStack sharpness5 = CommonItemUtil.sharpness(5);

ItemStack sharpness5Result = CommonItemUtil.sharpness(5);
Repairable meta = (Repairable) sharpness5Result.getItemMeta();
meta.setRepairCost(1);
sharpness5Result.setItemMeta(meta);

AnvilFuseTestData data = new AnvilFuseTestData(
sharpness4, sharpness4,
sharpness5
sharpness5Result
// TODO add expected price
);

Expand All @@ -66,9 +72,14 @@ public void overFuseTest(){
ItemStack sharpness4 = CommonItemUtil.sharpness(4);
ItemStack sharpness5 = CommonItemUtil.sharpness(5);

ItemStack sharpness5Result = CommonItemUtil.sharpness(5);
Repairable meta = (Repairable) sharpness5Result.getItemMeta();
meta.setRepairCost(1);
sharpness5Result.setItemMeta(meta);

AnvilFuseTestData data = new AnvilFuseTestData(
sharpness4, sharpness5,
sharpness5
sharpness5Result
// TODO add expected price
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testConflict() {
ItemStack sharpness1 = CommonItemUtil.sharpness(1);
ItemStack arthropods1 = CommonItemUtil.bane_of_arthropods(1);
ItemStack illegalResult = AnvilFuseTestUtil.prepareItem(
Material.DIAMOND_SWORD,
Material.DIAMOND_SWORD, 1,
List.of("bane_of_arthropods", "sharpness"),
1, 1
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void vanillaUnitRepair(){
resultPickaxe.setDurability((short) (Material.DIAMOND_PICKAXE.getMaxDurability()/2));
ItemMeta meta = resultPickaxe.getItemMeta();
((Repairable) meta).setRepairCost(1);
resultPickaxe.setItemMeta(meta);

ItemStack diamond2 = new ItemStackMock(Material.DIAMOND, 2);

Expand Down Expand Up @@ -93,6 +94,7 @@ void addUnitRepair(){
resultPickaxe.setDurability((short) (Material.DIAMOND_PICKAXE.getMaxDurability()/2));
ItemMeta meta = resultPickaxe.getItemMeta();
((Repairable) meta).setRepairCost(1);
resultPickaxe.setItemMeta(meta);

ItemStack stick2 = new ItemStackMock(Material.STICK, 2);

Expand Down

0 comments on commit 6f2b15a

Please sign in to comment.