/** Test method for {@link fr.squallco.score.model.Soccer#setHomeScorePlus1()}. */ @Test public void testSetHomeScorePlus1() { // Add 1 to score mSoccerModel.setHomeScorePlus1(); assertEquals(1, mSoccerModel.getHomeScore()); // Add 1 to shoot-out score in shoot-out mode mSoccerModel.setVisitorScorePlus1(); mSoccerModel.setShootOutMode(true); mSoccerModel.setHomeScorePlus1(); assertEquals(1, mSoccerModel.getHomeShootOutScore()); // Check that shoot-out score doesn't go over 99 for (int i = 0; i < 100; i++) { mSoccerModel.setHomeScorePlus1(); } assertEquals(99, mSoccerModel.getHomeShootOutScore()); // Check that score doesn't go over 99 mSoccerModel.setShootOutMode(false); for (int i = 0; i < 100; i++) { mSoccerModel.setHomeScorePlus1(); } assertEquals(99, mSoccerModel.getHomeScore()); }
/** Test method for {@link fr.squallco.score.model.Soccer#resetScore()}. */ @Test public void testResetScore() { mSoccerModel.setHomeScorePlus1(); mSoccerModel.setVisitorScorePlus1(); mSoccerModel.setShootOutMode(true); mSoccerModel.setHomeScorePlus1(); mSoccerModel.setVisitorScorePlus1(); mSoccerModel.resetScore(); assertEquals(0, mSoccerModel.getHomeScore()); assertEquals(0, mSoccerModel.getVisitorScore()); assertEquals(0, mSoccerModel.getHomeShootOutScore()); assertEquals(0, mSoccerModel.getVisitorShootOutScore()); assertFalse(mSoccerModel.isShootOutMode()); }
/** Test method for {@link fr.squallco.score.model.Soccer#setHomeScoreMinus1()}. */ @Test public void testSetHomeScoreMinus1() { // Remove 1 from score mSoccerModel.setHomeScorePlus1(); mSoccerModel.setHomeScoreMinus1(); assertEquals(0, mSoccerModel.getHomeScore()); // Check that score doesn't go under 0 mSoccerModel.setHomeScoreMinus1(); assertEquals(0, mSoccerModel.getHomeScore()); // Remove 1 from shoot-out score mSoccerModel.setShootOutMode(false); mSoccerModel.setHomeScorePlus1(); mSoccerModel.setHomeScoreMinus1(); assertEquals(0, mSoccerModel.getHomeShootOutScore()); // Check that shoot-out score doesn't go under 0 mSoccerModel.setHomeScoreMinus1(); assertEquals(0, mSoccerModel.getHomeShootOutScore()); }
/** Test method for {@link fr.squallco.score.model.Soccer#isShootOutMode()}. */ @Test public void testShootOutMode() { // Activate mSoccerModel.setShootOutMode(true); assertTrue(mSoccerModel.isShootOutMode()); // Deactivate mSoccerModel.setShootOutMode(false); assertFalse(mSoccerModel.isShootOutMode()); // No activation if scores aren't equal mSoccerModel.setHomeScorePlus1(); mSoccerModel.setShootOutMode(true); assertFalse(mSoccerModel.isShootOutMode()); // Activation if scores are equal mSoccerModel.setVisitorScorePlus1(); mSoccerModel.setShootOutMode(true); assertTrue(mSoccerModel.isShootOutMode()); }