3940414243444546474849
public void move() { BodyPart part = new BodyPart(0, 0); Point position = new Point(0, 0); part.direction = Direction.DOWN; part.move(1); position.y += 1; assertEquals(position, part.position); part.direction = Direction.RIGHT; part.move(5);
4445464748495051525354
part.move(1); position.y += 1; assertEquals(position, part.position); part.direction = Direction.RIGHT; part.move(5); position.x += 5; assertEquals(position, part.position); part.direction = Direction.UP; part.move(3);
4950515253545556575859
part.move(5); position.x += 5; assertEquals(position, part.position); part.direction = Direction.UP; part.move(3); position.y -= 3; assertEquals(position, part.position); part.direction = Direction.LEFT; part.move(2);
5455565758596061626364
part.move(3); position.y -= 3; assertEquals(position, part.position); part.direction = Direction.LEFT; part.move(2); position.x -= 2; assertEquals(position, part.position); } @Test