Skip to content

Commit 4fe24b5

Browse files
soloturnclaude
andauthored
fix(TypeHandlerLibrary): move StringRepresentationTypeHandlerTest's inner class to the end (#5389)
Checkstyle's InnerTypeLast rule wants init blocks, constructors, fields and methods before inner types - RecordingHandler was declared first, ahead of the field and @test methods that use it. Already on develop (via 962df32), so every PR built since has been failing checkstyle on a file they never touched. No behavior change, just reordered. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 338d7dd commit 4fe24b5

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

subsystems/TypeHandlerLibrary/src/test/java/org/terasology/persistence/typeHandling/StringRepresentationTypeHandlerTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,6 @@
1414

1515
class StringRepresentationTypeHandlerTest {
1616

17-
/**
18-
* Records whether {@link #getFromString} was reached. The contract under test is not just
19-
* "returns empty" but "never forwards null to the subclass" — asserting only on the returned
20-
* Optional would still pass if a subclass happened to tolerate null and return null itself.
21-
*/
22-
private static final class RecordingHandler extends StringRepresentationTypeHandler<String> {
23-
private boolean getFromStringCalled;
24-
25-
@Override
26-
public String getAsString(String item) {
27-
return item;
28-
}
29-
30-
@Override
31-
public String getFromString(String representation) {
32-
getFromStringCalled = true;
33-
return representation;
34-
}
35-
}
36-
3717
private final RecordingHandler typeHandler = new RecordingHandler();
3818

3919
@Test
@@ -63,4 +43,24 @@ void ignoresNonStringData() {
6343
assertFalse(result.isPresent());
6444
assertFalse(typeHandler.getFromStringCalled);
6545
}
46+
47+
/**
48+
* Records whether {@link #getFromString} was reached. The contract under test is not just
49+
* "returns empty" but "never forwards null to the subclass" — asserting only on the returned
50+
* Optional would still pass if a subclass happened to tolerate null and return null itself.
51+
*/
52+
private static final class RecordingHandler extends StringRepresentationTypeHandler<String> {
53+
private boolean getFromStringCalled;
54+
55+
@Override
56+
public String getAsString(String item) {
57+
return item;
58+
}
59+
60+
@Override
61+
public String getFromString(String representation) {
62+
getFromStringCalled = true;
63+
return representation;
64+
}
65+
}
6666
}

0 commit comments

Comments
 (0)