示例#1
0
  @Test
  public void should_show_statistics_on_first_question_of_resume_game()
      throws IOException, ItemException {

    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);

    expect(repositoryItemsCache.getItem(GameState.class)).andReturn(gameState);
    expect(repositoryItemsCache.getItem(Stats.class)).andReturn(stats);

    testModule.replay();

    quizzActivity.onCreate(null);

    quizzActivity.findViewById(R.id.buttonResumeGame).performClick();

    TableLayout footerTable = (TableLayout) quizzActivity.findViewById(R.id.footerTable);
    TextView score = (TextView) quizzActivity.findViewById(R.id.ScoreTextView);
    assertEquals(View.VISIBLE, footerTable.getVisibility());
    assertEquals("Score: 1 / 3", score.getText().toString());
  }
 boolean onCheckForConfirm(boolean showError) {
   boolean result = false;
   int msgId = 0;
   if (beneficiary_rg.getVisibility() == View.VISIBLE && mIbanCardManager.selectedPosition < 0) {
     result = true;
   } else if (input_benificiary_content.getVisibility() == View.VISIBLE
       && TextUtils.isEmpty(beneficiary_name_et.getText())) {
     result = true;
     msgId = R.string.beneficiary_name_empty_error;
   } else if (input_benificiary_content.getVisibility() == View.VISIBLE
       && TextUtils.isEmpty(iban_et.getText())) {
     result = true;
     msgId = R.string.card_number_empty;
   } else if (TextUtils.isEmpty(amount_et.getText())) {
     result = true;
     msgId = R.string.amount_empty_error;
   }
   //		else if(TextUtils.isEmpty(description_of_payment_et.getText())){
   //			result=true;
   //			msgId=R.string.description_empty_error;
   //		}
   else if (purpose_currency_liner.getVisibility() == View.VISIBLE
       && TextUtils.isEmpty(purpose_currency_et.getText())) {
     result = true;
     msgId = R.string.purpose_currency_empty_error;
   }
   //		else if(bic_et.getVisibility()==View.VISIBLE&&TextUtils.isEmpty(bic_et.getText())){
   //			result=true;
   //			msgId=R.string.bic_empty_error;
   //		}
   if (msgId > 0 && showError) {
     DialogManager.createMessageDialog(msgId, context).show();
   }
   this.confirmation_btn.setEnabled(!result);
   return result;
 }