From 9270d0e9682fd4d6dd690332e6a35ca1c44c9727 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 21:13:15 -0400 Subject: [PATCH] Automated Java code formatting changes (#786) Co-authored-by: Bram van Heuveln --- src/test/java/legup/TestRunner.java | 2 +- .../rules/FinishWithEmptyDirectRuleTest.java | 53 ++++++++++--------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/test/java/legup/TestRunner.java b/src/test/java/legup/TestRunner.java index 21d2ef500..8661f0e69 100644 --- a/src/test/java/legup/TestRunner.java +++ b/src/test/java/legup/TestRunner.java @@ -42,7 +42,7 @@ public static void main(String[] args) { Result result13 = JUnitCore.runClasses(TooManyBulbsContradictionRuleTest.class); printTestResults(result13); - //nurikabe tests + // nurikabe tests Result result14 = JUnitCore.runClasses(BlackBetweenRegionsDirectRuleTest.class); printTestResults(result14); Result result15 = JUnitCore.runClasses(BlackBottleNeckDirectRuleTest.class); diff --git a/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java b/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java index 3a032a35d..079641ee7 100644 --- a/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java +++ b/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java @@ -18,46 +18,48 @@ public class FinishWithEmptyDirectRuleTest { private static LightUp lightUp; @BeforeClass - public static void setUp() { lightUp = new LightUp(); } + public static void setUp() { + lightUp = new LightUp(); + } @Test public void FinishEmptyTestWithOne() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithOne", lightUp); + TestUtilities.importTestBoard( + "puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithOne", lightUp); TreeNode rootNode = lightUp.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); - //get board state + // get board state LightUpBoard board = (LightUpBoard) transition.getBoard(); // The board has a "1" clue at (1,1) with a bulb one space above at (1,0); - //change the board's cells considering the FinishWithEmpty rule to empty - LightUpCell cell1 = board.getCell(0,1); //left + // change the board's cells considering the FinishWithEmpty rule to empty + LightUpCell cell1 = board.getCell(0, 1); // left cell1.setData(LightUpCellType.EMPTY.value); board.addModifiedData(cell1); - LightUpCell cell2 = board.getCell(2,1); //right + LightUpCell cell2 = board.getCell(2, 1); // right cell2.setData(LightUpCellType.EMPTY.value); board.addModifiedData(cell2); - LightUpCell cell3 = board.getCell(1,2); //below + LightUpCell cell3 = board.getCell(1, 2); // below cell3.setData(LightUpCellType.EMPTY.value); board.addModifiedData(cell3); - //confirm there is a logical following of the FinishWithEmpty rule + // confirm there is a logical following of the FinishWithEmpty rule Assert.assertNull(RULE.checkRule(transition)); - //check every square except the top center (2,0) + // check every square except the top center (2,0) LightUpCell c; for (int i = 0; i < board.getHeight(); i++) { for (int j = 0; j < board.getWidth(); j++) { c = board.getCell(j, i); - if ((i == 1 && j == 0) || (i == 1 && j == 2) || (i == 2 && j == 1)){ - //logically follows + if ((i == 1 && j == 0) || (i == 1 && j == 2) || (i == 2 && j == 1)) { + // logically follows Assert.assertNull(RULE.checkRuleAt(transition, c)); - } - else { - //does not use the rule to logically follow + } else { + // does not use the rule to logically follow Assert.assertNotNull(RULE.checkRuleAt(transition, c)); } } @@ -66,34 +68,35 @@ public void FinishEmptyTestWithOne() throws InvalidFileFormatException { @Test public void FinishEmptyTestWithThree() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree", lightUp); + TestUtilities.importTestBoard( + "puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree", + lightUp); TreeNode rootNode = lightUp.getTree().getRootNode(); TreeTransition transition = rootNode.getChildren().get(0); transition.setRule(RULE); - //get board state + // get board state LightUpBoard board = (LightUpBoard) transition.getBoard(); // The board has a "3" clue at (1,1) with a bulbs at (0,1), (2,1), and (1,2) - //change the board's cells considering the FinishWithBulbs rule to empty - LightUpCell cell1 = board.getCell(1,0); + // change the board's cells considering the FinishWithBulbs rule to empty + LightUpCell cell1 = board.getCell(1, 0); cell1.setData(LightUpCellType.EMPTY.value); board.addModifiedData(cell1); - //confirm there is a logical following of the FinishWithBulbs rule + // confirm there is a logical following of the FinishWithBulbs rule Assert.assertNull(RULE.checkRule(transition)); - //check every square for logical following + // check every square for logical following LightUpCell c; for (int i = 0; i < board.getHeight(); i++) { for (int j = 0; j < board.getWidth(); j++) { c = board.getCell(j, i); - if (i == 0 && j == 1){ - //logically follows + if (i == 0 && j == 1) { + // logically follows Assert.assertNull(RULE.checkRuleAt(transition, c)); - } - else { - //does not use the rule to logically follow + } else { + // does not use the rule to logically follow Assert.assertNotNull(RULE.checkRuleAt(transition, c)); } }