@@ -23,7 +23,7 @@ public class StackableToolsGameTest : FabricGameTest {
2323 /* *
2424 * Test that two identical diamond pickaxes can be stacked.
2525 */
26- @GameTest
26+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
2727 public fun testIdenticalToolsCanStack (context : TestContext ) {
2828 val pickaxe1 = ItemStack (Items .DIAMOND_PICKAXE , 1 )
2929 val pickaxe2 = ItemStack (Items .DIAMOND_PICKAXE , 1 )
@@ -38,7 +38,7 @@ public class StackableToolsGameTest : FabricGameTest {
3838 /* *
3939 * Test that damaged tools cannot be stacked.
4040 */
41- @GameTest
41+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
4242 public fun testDamagedToolsCannotStack (context : TestContext ) {
4343 val pickaxe1 = ItemStack (Items .DIAMOND_PICKAXE , 1 )
4444 val pickaxe2 = ItemStack (Items .DIAMOND_PICKAXE , 1 )
@@ -56,7 +56,7 @@ public class StackableToolsGameTest : FabricGameTest {
5656 /* *
5757 * Test that different item types cannot be stacked.
5858 */
59- @GameTest
59+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
6060 public fun testDifferentItemsCannotStack (context : TestContext ) {
6161 val pickaxe = ItemStack (Items .DIAMOND_PICKAXE , 1 )
6262 val axe = ItemStack (Items .DIAMOND_AXE , 1 )
@@ -71,7 +71,7 @@ public class StackableToolsGameTest : FabricGameTest {
7171 /* *
7272 * Test that empty stacks cannot be stacked.
7373 */
74- @GameTest
74+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
7575 public fun testEmptyStacksCannotStack (context : TestContext ) {
7676 val pickaxe = ItemStack (Items .DIAMOND_PICKAXE , 1 )
7777 val empty = ItemStack .EMPTY
@@ -86,7 +86,7 @@ public class StackableToolsGameTest : FabricGameTest {
8686 /* *
8787 * Test that diamond pickaxes are identified as stackable when tools category is active.
8888 */
89- @GameTest
89+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
9090 public fun testToolsAreStackableWhenCategoryActive (context : TestContext ) {
9191 val pickaxe = ItemStack (Items .DIAMOND_PICKAXE , 1 )
9292
@@ -100,7 +100,7 @@ public class StackableToolsGameTest : FabricGameTest {
100100 /* *
101101 * Test that potions are identified as stackable when potions category is active.
102102 */
103- @GameTest
103+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
104104 public fun testPotionsAreStackableWhenCategoryActive (context : TestContext ) {
105105 val potion = ItemStack (Items .POTION , 1 )
106106
@@ -114,7 +114,7 @@ public class StackableToolsGameTest : FabricGameTest {
114114 /* *
115115 * Test that enchanted books are identified as stackable when enchanted books category is active.
116116 */
117- @GameTest
117+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
118118 public fun testEnchantedBooksAreStackable (context : TestContext ) {
119119 val enchantedBook = ItemStack (Items .ENCHANTED_BOOK , 1 )
120120
@@ -128,7 +128,7 @@ public class StackableToolsGameTest : FabricGameTest {
128128 /* *
129129 * Test that weapons (swords) are identified as stackable when weapons category is active.
130130 */
131- @GameTest
131+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
132132 public fun testWeaponsAreStackableWhenCategoryActive (context : TestContext ) {
133133 val sword = ItemStack (Items .DIAMOND_SWORD , 1 )
134134
@@ -142,7 +142,7 @@ public class StackableToolsGameTest : FabricGameTest {
142142 /* *
143143 * Test that armor pieces are identified as stackable when armors category is active.
144144 */
145- @GameTest
145+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
146146 public fun testArmorIsStackableWhenCategoryActive (context : TestContext ) {
147147 val helmet = ItemStack (Items .DIAMOND_HELMET , 1 )
148148
@@ -156,7 +156,7 @@ public class StackableToolsGameTest : FabricGameTest {
156156 /* *
157157 * Test that elytra is identified as stackable when elytra category is active.
158158 */
159- @GameTest
159+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
160160 public fun testElytraIsStackableWhenCategoryActive (context : TestContext ) {
161161 val elytra = ItemStack (Items .ELYTRA , 1 )
162162
@@ -170,7 +170,7 @@ public class StackableToolsGameTest : FabricGameTest {
170170 /* *
171171 * Test that regular items (like dirt) are not stackable.
172172 */
173- @GameTest
173+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
174174 public fun testRegularItemsNotStackable (context : TestContext ) {
175175 val dirt = ItemStack (Items .DIRT , 1 )
176176
@@ -184,7 +184,7 @@ public class StackableToolsGameTest : FabricGameTest {
184184 /* *
185185 * Test that empty stacks are not stackable.
186186 */
187- @GameTest
187+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
188188 public fun testEmptyStackNotStackable (context : TestContext ) {
189189 val empty = ItemStack .EMPTY
190190
@@ -198,7 +198,7 @@ public class StackableToolsGameTest : FabricGameTest {
198198 /* *
199199 * Test that two identical swords without damage can be stacked.
200200 */
201- @GameTest
201+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
202202 public fun testIdenticalSwordsCanStack (context : TestContext ) {
203203 val sword1 = ItemStack (Items .DIAMOND_SWORD , 1 )
204204 val sword2 = ItemStack (Items .DIAMOND_SWORD , 1 )
@@ -213,7 +213,7 @@ public class StackableToolsGameTest : FabricGameTest {
213213 /* *
214214 * Test that armor pieces with different damage levels cannot be stacked.
215215 */
216- @GameTest
216+ @GameTest(templateName = " fabric-gametest-api-v1:empty " )
217217 public fun testDifferentlyDamagedArmorCannotStack (context : TestContext ) {
218218 val helmet1 = ItemStack (Items .DIAMOND_HELMET , 1 )
219219 val helmet2 = ItemStack (Items .DIAMOND_HELMET , 1 )
@@ -232,13 +232,12 @@ public class StackableToolsGameTest : FabricGameTest {
232232 */
233233 override fun invokeTestMethod (context : TestContext , method : Method ) {
234234 try {
235- // Ensure configuration is loaded before test
236235 ConfigManager .loadConfig()
237-
238- // Run the test method
239236 method.invoke(this , context)
237+ } catch (e: java.lang.reflect.InvocationTargetException ) {
238+ context.throwGameTestException(" Test failed: ${e.cause?.message ? : e.cause?.javaClass?.simpleName ? : " Unknown error" } " )
240239 } catch (e: Exception ) {
241- context.throwGameTestException(" Test failed with exception : ${e.message} " )
240+ context.throwGameTestException(" Test failed: ${e.message ? : e.javaClass.simpleName } " )
242241 }
243242 }
244243}
0 commit comments