mardi 5 juillet 2016

How to unit test if-else statement in android?

How do I write unit test case for this method in my presenter class?

private void setTextViewFromDateObject(DateAnswer dateObject) {
   if (mDateWithoutCalendarView.getDateFormat().equalsIgnoreCase(QuestionnaireUtils.DDMMYYYY_FORMAT)) {

       mDateWithoutCalendarView.setDateInTextView(String.valueOf(dateObject.getDay()) + "/" +
               String.valueOf(dateObject.getMonth()) + "/"+ String.valueOf(dateObject.getYear()));

   } else {

       mDateWithoutCalendarView.setDateInTextView(String.valueOf(dateObject.getMonth()) + "/" +
               String.valueOf(dateObject.getDay())+ "/" + String.valueOf(dateObject.getYear()));

   }
 }

Aucun commentaire:

Enregistrer un commentaire