Ejemplo n.º 1
0
  @Test
  public void should_not_show_resume_game_button() throws IOException, ItemException {

    commonExpectsInitGame(buildEMptyGameState(), buildEmptyStats());

    testModule.replay();

    quizzActivity.onCreate(null);

    Button resumeGameButton = (Button) quizzActivity.findViewById(R.id.buttonResumeGame);
    assertEquals(View.GONE, resumeGameButton.getVisibility());

    testModule.verify();
  }
Ejemplo n.º 2
0
  @Test
  public void should_show_resume_game_button() throws ItemException, IOException {

    Set<Integer> answeredItemId = new HashSet<Integer>();
    answeredItemId.add(0);
    Set<Integer> goodAnsweredItemId = new HashSet<Integer>();
    goodAnsweredItemId.add(0);
    Stats stats = new Stats(answeredItemId, goodAnsweredItemId);

    GameState gameState = new GameState(Arrays.asList(1, 2));

    commonExpectsInitGame(gameState, stats);

    testModule.replay();

    quizzActivity.onCreate(null);

    Button resumeGameButton = (Button) quizzActivity.findViewById(R.id.buttonResumeGame);
    assertEquals(
        "Resume button should be visible.", View.VISIBLE, resumeGameButton.getVisibility());

    testModule.verify();
  }