@Test public void addBallTest() { assertEquals(model.getBalls(), new ArrayList<Ball>()); model.addBall("b1", 10, 10, 50, 50); model.addBall("b2", 10, 10, 50, 50); assertTrue(model.getBalls().size() == 1); }
@Test public void setBallsTest() { List<Ball> balls = new ArrayList<Ball>(); Ball ball = new Ball("b1", 5, 5, 50, 50); balls.add(ball); model.setBalls(balls); assertTrue(model.getBalls().size() == 1); assertEquals(model.getBalls().get(0), ball); }
@Test public void moveBallTest() { model.addSquareBumper(40, 0, 0, "sBump"); model.addFlipper(60, 60, false, "flipper"); model.addAbsorber("absorb", 0, 180, 200, 200); model.addBall("b1", 10, 10, 50, 50); model.moveModel(); assertTrue(model.getBalls().get(0).getX() != 10); assertTrue(model.getBalls().get(0).getY() != 10); model.reset(); assertTrue(model.getBalls().get(0).getX() == 10); assertTrue(model.getBalls().get(0).getX() == 10); }