fix test
moved the when().thenReturn to setReadings
This commit is contained in:
parent
6e63d340cd
commit
453faf736d
1 changed files with 9 additions and 18 deletions
|
@ -118,29 +118,20 @@ public class BgReadingTest {
|
||||||
|
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
||||||
assertEquals("NONE", bgReading.calculateDirection());
|
assertEquals("NONE", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(72,0);
|
setReadings(72,0);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("DoubleUp", bgReading.calculateDirection());
|
assertEquals("DoubleUp", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(76,60);
|
setReadings(76,60);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("SingleUp", bgReading.calculateDirection());
|
assertEquals("SingleUp", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(74,65);
|
setReadings(74,65);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("FortyFiveUp", bgReading.calculateDirection());
|
assertEquals("FortyFiveUp", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(72,72);
|
setReadings(72,72);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("Flat", bgReading.calculateDirection());
|
assertEquals("Flat", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(0,72);
|
setReadings(0,72);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("DoubleDown", bgReading.calculateDirection());
|
assertEquals("DoubleDown", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(60,76);
|
setReadings(60,76);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("SingleDown", bgReading.calculateDirection());
|
assertEquals("SingleDown", bgReading.calculateDirection());
|
||||||
bgReadingsList = setReadings(65,74);
|
setReadings(65,74);
|
||||||
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
|
|
||||||
assertEquals("FortyFiveDown", bgReading.calculateDirection());
|
assertEquals("FortyFiveDown", bgReading.calculateDirection());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -152,7 +143,7 @@ public class BgReadingTest {
|
||||||
AAPSMocker.mockDatabaseHelper();
|
AAPSMocker.mockDatabaseHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BgReading> setReadings(int current_value, int previous_value){
|
public void setReadings(int current_value, int previous_value){
|
||||||
BgReading now = new BgReading();
|
BgReading now = new BgReading();
|
||||||
now.value = current_value;
|
now.value = current_value;
|
||||||
now.date = System.currentTimeMillis();
|
now.date = System.currentTimeMillis();
|
||||||
|
@ -163,6 +154,6 @@ public class BgReadingTest {
|
||||||
add(now);
|
add(now);
|
||||||
add(previous);
|
add(previous);
|
||||||
}};
|
}};
|
||||||
return bgReadings;
|
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadings);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue