Skip to content

Commit e1c0272

Browse files
committed
chore: use test suite name as group rather than batch
1 parent 003e099 commit e1c0272

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/main/java/dev/galacticraft/machinelib/api/gametest/SimpleGameTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ public abstract class SimpleGameTest implements FabricGameTest {
7575
return tests;
7676
}
7777

78-
protected String getTestBatch() {
79-
TestSuite annotation = this.getClass().getAnnotation(TestSuite.class);
80-
if (annotation != null) return annotation.value();
81-
return "defaultBatch";
82-
}
83-
8478
@Override
8579
public void invokeTestMethod(GameTestHelper context, Method method) {
8680
// don't invoke fabric if there is no annotation (generated test)
@@ -96,9 +90,10 @@ protected TestFunction createTest(@Nullable String group, String name, String st
9690
}
9791

9892
protected TestFunction createTest(@Nullable String batch, @Nullable String group, String name, String structure, int ticks, int setupTicks, Consumer<GameTestHelper> test) {
93+
batch = batch == null || batch.isBlank() ? "defaultBatch" : batch;
9994
return new TestFunction(
100-
batch == null || batch.isBlank() ? this.getTestBatch() : batch,
101-
GameTestUtils.generateTestName(batch == null || batch.isBlank() ? this.getTestBatch() : batch, group, name),
95+
batch,
96+
GameTestUtils.generateTestName(batch, group == null || group.isBlank() ? getDefaultTestGroup() : group, name),
10297
structure,
10398
Rotation.NONE,
10499
ticks,
@@ -107,4 +102,9 @@ protected TestFunction createTest(@Nullable String batch, @Nullable String group
107102
test
108103
);
109104
}
105+
106+
private String getDefaultTestGroup() {
107+
TestSuite annotation = this.getClass().getAnnotation(TestSuite.class);
108+
return annotation != null ? annotation.value() : null;
109+
}
110110
}

src/main/java/dev/galacticraft/machinelib/api/gametest/annotation/BasicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
*
5454
* @see GameTest#batch()
5555
*/
56-
String batch();
56+
String batch() default "defaultBatch";
5757

5858
/**
5959
* {@return the group name of the test}

0 commit comments

Comments
 (0)