@Test public void testPlay_mower_out_of_lawn() { // set int length = 0; int width = 0; int x = 0; int y = 0; Direction direction = Direction.NORTH; String command = "F"; Mower mower = new Mower(x, y, direction); Lawn lawn = new Lawn(length, width, mower); // test Mower response = simulation.play(lawn, command); // assert assertEquals(response, mower); }
@Test public void testPlay_example() { // set int length = 5; int width = 5; int x = 1; int y = 2; Direction direction = Direction.NORTH; String command = "LFLFLFLFF"; Mower mower = new Mower(x, y, direction); Lawn lawn = new Lawn(length, width, mower); // test Mower response = simulation.play(lawn, command); // assert Mower expected = new Mower(1, 3, Direction.NORTH); assertEquals(response, expected); }
@Test public void testPlay_other_example() { // set int length = 5; int width = 5; int x = 3; int y = 3; Direction direction = Direction.EAST; String command = "FFRFFRFRRF"; Mower mower = new Mower(x, y, direction); Lawn lawn = new Lawn(length, width, mower); // test Mower response = simulation.play(lawn, command); // assert Mower expected = new Mower(5, 1, Direction.EAST); assertEquals(response, expected); }