lundi 11 juillet 2016

NullPointerException while testing app

I've got a problem while testing my app, class "DateToday" exactly, here's part of that class:

public DateToday(){
    monthName();
    dayName();
    dayNumber();
    yearNumber();
}

public int yearNumber(){
    year = c.get(Calendar.YEAR);
    return year;
}

And here's my test class:

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class DateTodayTest {

private DateToday mDateToday;

@Test
public void checkYear() {
    assertEquals(mDateToday.yearNumber(), 2016);
}

Why I am still having NullPointerException at checkYear() method and the test is failed? It may be a stupid issue but I am blind with that...

Aucun commentaire:

Enregistrer un commentaire