Exemple #1
0
  /** 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());
  }
Exemple #2
0
  /** 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());
  }
Exemple #3
0
 /** Test method for {@link fr.squallco.score.model.Soccer#getVisitorShootOutScore()}. */
 @Test
 public void testGetVisitorShootOutScore() {
   assertEquals(0, mSoccerModel.getVisitorShootOutScore());
 }
Exemple #4
0
 /** Test method for {@link fr.squallco.score.model.Soccer#getHomeScore()}. */
 @Test
 public void testGetHomeScore() {
   assertEquals(0, mSoccerModel.getHomeScore());
 }
Exemple #5
0
 /** Test method for {@link fr.squallco.score.model.Soccer#getScoreIdentifier()}. */
 @Test
 public void testGetScoreIdentifier() {
   assertEquals(ScoreIdentifier.SOCCER, mSoccerModel.getScoreIdentifier());
 }
Exemple #6
0
  /** 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());
  }
Exemple #7
0
  /** Test method for {@link fr.squallco.score.model.Soccer#setVisitorScoreMinus1()}. */
  @Test
  public void testSetVisitorScoreMinus1() {
    // Remove 1 from score
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorScore());

    // Check that score doesn't go under 0
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorScore());

    // Remove 1 from shoot-out score
    mSoccerModel.setShootOutMode(false);
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorShootOutScore());

    // Check that shoot-out score doesn't go under 0
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorShootOutScore());
  }