Applying Java migration aids for Java 15.

This commit is contained in:
Rob Greene
2025-10-18 18:03:42 -07:00
parent 9c55467c09
commit 5d1dad9fc9
2 changed files with 62 additions and 50 deletions
@@ -34,13 +34,15 @@ public class ShapeGeneratorTest {
assertNotNull(st);
assertEquals(1, st.shapes.size());
final String expected = "+-----+\n"
+ "|.XXX.|\n"
+ "|X...X|\n"
+ "|X.+.X|\n"
+ "|X...X|\n"
+ "|.XXX.|\n"
+ "+-----+\n";
final String expected = """
+-----+
|.XXX.|
|X...X|
|X.+.X|
|X...X|
|.XXX.|
+-----+
""";
assertShapeMatches(expected, st.shapes.get(0));
}
@@ -67,17 +69,19 @@ public class ShapeGeneratorTest {
@Test
public void testMouseShape() throws IOException {
final String mouse = "+--------------+\n"
+ "|..........*X..|\n"
+ "|....XXXX.XX...|\n"
+ "|...XXXXXXXX...|\n"
+ "|.XXXXXXXXXXX..|\n"
+ "|XX.XXXXXXX.XX.|\n"
+ "|X...XXXXXXXXXX|\n"
+ "|XX............|\n"
+ "|.XXX.XX.......|\n"
+ "|...XXX........|\n"
+ "+--------------+\n";
final String mouse = """
+--------------+
|..........*X..|
|....XXXX.XX...|
|...XXXXXXXX...|
|.XXXXXXXXXXX..|
|XX.XXXXXXX.XX.|
|X...XXXXXXXXXX|
|XX............|
|.XXX.XX.......|
|...XXX........|
+--------------+
""";
ShapeTable st = ShapeGenerator.generate(getClass().getResourceAsStream("/mouse-bitmap.st"));
assertNotNull(st);
@@ -96,21 +100,23 @@ public class ShapeGeneratorTest {
@Test
public void testRobotShape() throws IOException {
final String robot = "+-------------+\n"
+ "|....XXXXX...+|\n"
+ "|XXXXX...XX...|\n"
+ "|....XXXXX....|\n"
+ "|.............|\n"
+ "|..XX..XXX....|\n"
+ "|...XX.XXX....|\n"
+ "|...XX.XXXX...|\n"
+ "|..XX.XXXXX...|\n"
+ "|....XXXXXX...|\n"
+ "|.XXXXXXXXXXX.|\n"
+ "|XX.........XX|\n"
+ "|XX.........XX|\n"
+ "|.XXXXXXXXXXX.|\n"
+ "+-------------+\n";
final String robot = """
+-------------+
|....XXXXX...+|
|XXXXX...XX...|
|....XXXXX....|
|.............|
|..XX..XXX....|
|...XX.XXX....|
|...XX.XXXX...|
|..XX.XXXXX...|
|....XXXXXX...|
|.XXXXXXXXXXX.|
|XX.........XX|
|XX.........XX|
|.XXXXXXXXXXX.|
+-------------+
""";
ShapeTable st = ShapeGenerator.generate(getClass().getResourceAsStream("/robot-bitmap.st"));
assertNotNull(st);
@@ -99,11 +99,13 @@ public class ShapesTest {
public void testTextShapeExporterNoBorder() throws IOException {
ShapeTable st = readStandardShapeTable();
final String expected = ".XXX.\n"
+ "X...X\n"
+ "X.+.X\n"
+ "X...X\n"
+ ".XXX.\n";
final String expected = """
.XXX.
X...X
X.+.X
X...X
.XXX.
""";
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ShapeExporter exp = ShapeExporter.text().noBorder().build();
@@ -117,13 +119,15 @@ public class ShapesTest {
public void testTextShapeExporterAsciiBorder() throws IOException {
ShapeTable st = readStandardShapeTable();
final String expected = "+-----+\n"
+ "|.XXX.|\n"
+ "|X...X|\n"
+ "|X.+.X|\n"
+ "|X...X|\n"
+ "|.XXX.|\n"
+ "+-----+\n";
final String expected = """
+-----+
|.XXX.|
|X...X|
|X.+.X|
|X...X|
|.XXX.|
+-----+
""";
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ShapeExporter exp = ShapeExporter.text().asciiTextBorder().build();
@@ -142,11 +146,13 @@ public class ShapesTest {
st.shapes.add(st.shapes.get(0));
st.shapes.add(st.shapes.get(0));
final String oneExpectedRow = ".XXX. .XXX.\n"
+ "X...X X...X\n"
+ "X.+.X X.+.X\n"
+ "X...X X...X\n"
+ ".XXX. .XXX.\n";
final String oneExpectedRow = """
.XXX. .XXX.
X...X X...X
X.+.X X.+.X
X...X X...X
.XXX. .XXX.
""";
String expected = oneExpectedRow + "\n" + oneExpectedRow;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();