From bc477506342411e9156b3230d847cb92bcb8e5f9 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 24 Nov 2015 11:11:17 +0100 Subject: Reformat code --- src/ch/epfl/maze/tests/AnimalTest.java | 7 +------ src/ch/epfl/maze/tests/Competition.java | 8 +------- src/ch/epfl/maze/tests/DaedalusTest.java | 4 +--- src/ch/epfl/maze/tests/GhostsTest.java | 8 +------- src/ch/epfl/maze/tests/MazeTest.java | 4 +--- src/ch/epfl/maze/tests/WorldTest.java | 16 +--------------- src/ch/epfl/maze/tests/ZooTest.java | 11 +---------- 7 files changed, 7 insertions(+), 51 deletions(-) (limited to 'src/ch/epfl/maze/tests') diff --git a/src/ch/epfl/maze/tests/AnimalTest.java b/src/ch/epfl/maze/tests/AnimalTest.java index 4a590ae..123c038 100644 --- a/src/ch/epfl/maze/tests/AnimalTest.java +++ b/src/ch/epfl/maze/tests/AnimalTest.java @@ -9,13 +9,11 @@ import org.junit.Test; /** * Test case for {@code Animal} implementation. */ - public class AnimalTest extends TestCase { /** * Test case for {@code getPosition()}. */ - @Test public void testGetPosition() { Animal animal = new MockAnimal(new Vector2D(2, 1)); @@ -27,7 +25,6 @@ public class AnimalTest extends TestCase { /** * Test case for {@code setPosition(Vector2D position)}. */ - @Test public void testSetPosition() { Animal animal = new MockAnimal(new Vector2D(2, 1)); @@ -40,7 +37,6 @@ public class AnimalTest extends TestCase { /** * Test case for {@code update(Direction dir)}. */ - @Test public void testUpdate() { Animal animal = new MockAnimal(new Vector2D(2, 1)); @@ -69,7 +65,6 @@ public class AnimalTest extends TestCase { /** * Mock class that makes {@code Animal} concrete. */ - private class MockAnimal extends Animal { /** @@ -77,7 +72,6 @@ public class AnimalTest extends TestCase { * * @param labyrinth Actual maze */ - public MockAnimal(Vector2D position) { super(position); } @@ -92,4 +86,5 @@ public class AnimalTest extends TestCase { return null; } } + } diff --git a/src/ch/epfl/maze/tests/Competition.java b/src/ch/epfl/maze/tests/Competition.java index ccbbe73..10a6c84 100644 --- a/src/ch/epfl/maze/tests/Competition.java +++ b/src/ch/epfl/maze/tests/Competition.java @@ -31,7 +31,6 @@ import static org.junit.Assert.assertTrue; * against it. * */ - public class Competition { static final String COMPETITION_MAZE_FILE = "labyrinth.txt"; @@ -42,7 +41,6 @@ public class Competition { * Launches the competition between the {@code SpaceInvader} and the other * animals. */ - @BeforeClass public static void setUpClass() { int[][] labyrinth = LabyrinthGenerator.readFromFile(COMPETITION_MAZE_FILE); @@ -112,7 +110,6 @@ public class Competition { /** * Determines if the {@code SpaceInvader} has beaten the {@code Mouse}. */ - @Test public void testVSMouse() { assertTrue("The SpaceInvader has not beaten the Mouse", rivalries.get("Mouse") > 0); @@ -121,7 +118,6 @@ public class Competition { /** * Determines if the {@code SpaceInvader} has beaten the {@code Hamster}. */ - @Test public void testVSHamster() { assertTrue("The SpaceInvader has not beaten the Hamster", rivalries.get("Hamster") > 0); @@ -130,7 +126,6 @@ public class Competition { /** * Determines if the {@code SpaceInvader} has beaten the {@code Monkey}. */ - @Test public void testVSMonkey() { assertTrue("The SpaceInvader has not beaten the Monkey", rivalries.get("Monkey") > 0); @@ -139,7 +134,6 @@ public class Competition { /** * Determines if the {@code SpaceInvader} has beaten the {@code Bear}. */ - @Test public void testVSBear() { assertTrue("The SpaceInvader has not beaten the Bear", rivalries.get("Bear") > 0); @@ -148,9 +142,9 @@ public class Competition { /** * Determines if the {@code SpaceInvader} has beaten the {@code Panda}. */ - @Test public void testVSPanda() { assertTrue("The SpaceInvader has not beaten the Panda", rivalries.get("Panda") > 0); } + } diff --git a/src/ch/epfl/maze/tests/DaedalusTest.java b/src/ch/epfl/maze/tests/DaedalusTest.java index 070b70d..6087338 100644 --- a/src/ch/epfl/maze/tests/DaedalusTest.java +++ b/src/ch/epfl/maze/tests/DaedalusTest.java @@ -13,7 +13,6 @@ import org.junit.Test; /** * Test case for {@code Daedalus} implementation. */ - public class DaedalusTest extends TestCase { private final static int[][] LABYRINTH = { @@ -25,7 +24,6 @@ public class DaedalusTest extends TestCase { /** * Test case for several methods in {@code Daedalus}. */ - @Test public void testGeneral() { Daedalus daedalus = new Daedalus(LABYRINTH); @@ -83,7 +81,6 @@ public class DaedalusTest extends TestCase { /** * Test case for {@code reset()}. */ - @Test public void testReset() { Daedalus daedalus = new Daedalus(LABYRINTH); @@ -117,4 +114,5 @@ public class DaedalusTest extends TestCase { assertTrue("Animals in Daedalus should be not null", retrievedPred != null); assertTrue("Animals in Daedalus should be not null", retrievedPrey != null); } + } diff --git a/src/ch/epfl/maze/tests/GhostsTest.java b/src/ch/epfl/maze/tests/GhostsTest.java index c8c71a9..f4e0c2e 100644 --- a/src/ch/epfl/maze/tests/GhostsTest.java +++ b/src/ch/epfl/maze/tests/GhostsTest.java @@ -19,7 +19,6 @@ import org.junit.Test; /** * Test suite for ghosts implementation. */ - public class GhostsTest extends TestCase { public static final boolean DEBUG = false; @@ -29,7 +28,6 @@ public class GhostsTest extends TestCase { *

* In this case, Blinky should go straight to the PacMan's position. */ - @Test public void testBlinky() { int[][] labyrinth = LabyrinthGenerator.getDebugBlinky(); @@ -50,7 +48,6 @@ public class GhostsTest extends TestCase { *

* In this case, Pinky should go back and forth. */ - @Test public void testPinky() { int[][] labyrinth = LabyrinthGenerator.getDebugPinky(); @@ -71,7 +68,6 @@ public class GhostsTest extends TestCase { *

* In this case, Inky should target the red tile of the labyrinth. */ - @Test public void testInky() { int[][] labyrinth = LabyrinthGenerator.getDebugInky(); @@ -93,7 +89,6 @@ public class GhostsTest extends TestCase { *

* In this case, Clyde should go back and forth. */ - @Test public void testClyde() { int[][] labyrinth = LabyrinthGenerator.getDebugClyde(); @@ -112,7 +107,6 @@ public class GhostsTest extends TestCase { /** * Mock class to create a dummy PacMan in our testing unit. */ - private class PacMan extends Prey { private boolean mMoves; @@ -123,7 +117,6 @@ public class GhostsTest extends TestCase { * @param position Starting position of PacMan in the labyrinth * @param moves Determines if the dummy PacMan will move back and forth */ - public PacMan(Vector2D position, boolean moves) { super(position); mMoves = moves; @@ -142,4 +135,5 @@ public class GhostsTest extends TestCase { return new PacMan(getPosition(), mMoves); } } + } diff --git a/src/ch/epfl/maze/tests/MazeTest.java b/src/ch/epfl/maze/tests/MazeTest.java index c0660db..52651e1 100644 --- a/src/ch/epfl/maze/tests/MazeTest.java +++ b/src/ch/epfl/maze/tests/MazeTest.java @@ -10,7 +10,6 @@ import org.junit.Test; /** * Test case for {@code Maze} implementation. */ - public class MazeTest extends TestCase { private final static int[][] LABYRINTH = { @@ -22,7 +21,6 @@ public class MazeTest extends TestCase { /** * Test case for several methods in {@code Maze}. */ - @Test public void testGeneral() { Maze maze = new Maze(LABYRINTH); @@ -62,7 +60,6 @@ public class MazeTest extends TestCase { /** * Test case for {@code reset()}. */ - @Test public void testReset() { Maze maze = new Maze(LABYRINTH); @@ -85,4 +82,5 @@ public class MazeTest extends TestCase { assertTrue("Animal in Maze should be a Mouse", retrieved != null); } + } diff --git a/src/ch/epfl/maze/tests/WorldTest.java b/src/ch/epfl/maze/tests/WorldTest.java index dccd1ab..845c689 100644 --- a/src/ch/epfl/maze/tests/WorldTest.java +++ b/src/ch/epfl/maze/tests/WorldTest.java @@ -15,7 +15,6 @@ import static org.junit.Assert.assertArrayEquals; /** * Test case for {@code World} implementation. */ - public class WorldTest extends TestCase { /* sample labyrinth */ @@ -55,7 +54,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code getTile(int x, int y)}. */ - @Test public void testGetTile() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -75,7 +73,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code isFree(int x, int y)}. */ - @Test public void testIsFree() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -93,7 +90,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code getWidth()}. */ - @Test public void testGetWidth() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -105,7 +101,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code getHeight()}. */ - @Test public void testGetHeight() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -117,7 +112,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code getStart()}. */ - @Test public void testGetStart() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -129,7 +123,6 @@ public class WorldTest extends TestCase { /** * Test case for {@code getExit()}. */ - @Test public void testGetExit() { World world = new ConcreteWorld(LABYRINTH_SAMPLE); @@ -144,7 +137,6 @@ public class WorldTest extends TestCase { * Test case for {@code getChoices(Vector2D position)} * when there are 0 choices. */ - @Test public void testZeroChoice() { World world = new ConcreteWorld(LABYRINTH_STUCK); @@ -158,7 +150,6 @@ public class WorldTest extends TestCase { * Test case for {@code getChoices(Vector2D position)} * when there is 1 choice. */ - @Test public void testOneChoice() { World world = new ConcreteWorld(LABYRINTH_CORRIDOR); @@ -185,7 +176,6 @@ public class WorldTest extends TestCase { * Test case for {@code getChoices(Vector2D position)} * when there are 2 choices. */ - @Test public void testTwoChoices() { World world = new ConcreteWorld(LABYRINTH_DOGHNUT); @@ -226,7 +216,6 @@ public class WorldTest extends TestCase { * Test case for {@code getChoices(Vector2D position)} * when there are 3 choices. */ - @Test public void testThreeChoices() { World world = new ConcreteWorld(LABYRINTH_SQUARE); @@ -257,7 +246,6 @@ public class WorldTest extends TestCase { * Test case for {@code getChoices(Vector2D position)} * when there are 4 choices. */ - @Test public void testFourChoices() { World world = new ConcreteWorld(LABYRINTH_SQUARE); @@ -278,7 +266,6 @@ public class WorldTest extends TestCase { * @param result The choices computed with method {@code getChoices(position)} * @param expected The choices expected to be present */ - private void checkChoices(Direction[] result, Direction[] expected) { // checks that array was initialized assertNotNull(result); @@ -292,7 +279,6 @@ public class WorldTest extends TestCase { /** * Mock class that makes {@code World} concrete. */ - private final class ConcreteWorld extends World { /** @@ -300,7 +286,6 @@ public class WorldTest extends TestCase { * * @param labyrinth Actual maze */ - public ConcreteWorld(int[][] labyrinth) { super(labyrinth); } @@ -320,4 +305,5 @@ public class WorldTest extends TestCase { return null; } } + } diff --git a/src/ch/epfl/maze/tests/ZooTest.java b/src/ch/epfl/maze/tests/ZooTest.java index 04b6a79..03a84b3 100644 --- a/src/ch/epfl/maze/tests/ZooTest.java +++ b/src/ch/epfl/maze/tests/ZooTest.java @@ -12,7 +12,6 @@ import org.junit.Test; /** * Test cases for animals implementation. */ - public class ZooTest extends TestCase { public static final boolean DEBUG = false; @@ -22,7 +21,6 @@ public class ZooTest extends TestCase { *

* The Mouse should go forward and never retrace its steps. */ - @Test public void testMouse() { int[][] labyrinth = LabyrinthGenerator.getDebugMouse(); @@ -42,7 +40,6 @@ public class ZooTest extends TestCase { *

* The Hamster should never revisit a dead-end it has already visited. */ - @Test public void testHamster() { int[][] labyrinth = LabyrinthGenerator.getDebugHamster(); @@ -62,7 +59,6 @@ public class ZooTest extends TestCase { *

* The Monkey should go directly to the exit without taking any dead-end. */ - @Test public void testMonkey() { int[][] labyrinth = LabyrinthGenerator.getDebugMonkey(); @@ -84,7 +80,6 @@ public class ZooTest extends TestCase { * it loops infinitely in this maze, it means that it does not properly * count the turns it makes. */ - @Test public void testBear1() { int[][] labyrinth = LabyrinthGenerator.getDebugBear1(); @@ -105,7 +100,6 @@ public class ZooTest extends TestCase { * If the Bear loops infinitely in this maze, it means that it does not * properly count the turns it makes. */ - @Test public void testBear2() { int[][] labyrinth = LabyrinthGenerator.getDebugBear2(); @@ -126,7 +120,6 @@ public class ZooTest extends TestCase { * When the Panda comes back to the intersection, then it must leave the * position marked once and go back into the loop. */ - @Test public void testPanda1() { int[][] labyrinth = LabyrinthGenerator.getDebugPanda1(); @@ -147,7 +140,6 @@ public class ZooTest extends TestCase { * The Panda must mark the intersection twice only the very last time it * walks on it. */ - @Test public void testPanda2() { int[][] labyrinth = LabyrinthGenerator.getDebugPanda2(); @@ -167,7 +159,6 @@ public class ZooTest extends TestCase { *

* The Bear should leave the maze while the Monkey should loop infinitely. */ - @Test public void testBearVsMonkey() { int[][] labyrinth = LabyrinthGenerator.getBearVsMonkey(); @@ -188,7 +179,6 @@ public class ZooTest extends TestCase { * The Panda should leave the maze earlier than the Hamster with a higher * probability than the Hamster. */ - @Test public void testPandaVsHamster() { int[][] labyrinth = LabyrinthGenerator.getPandaVsHamster(); @@ -202,4 +192,5 @@ public class ZooTest extends TestCase { Display display = new Display(simulation); display.run(); } + } -- cgit v1.2.3