Test stubs.
This commit is contained in:
parent
c18effd893
commit
6d437b4afa
2 changed files with 26 additions and 2 deletions
|
@ -54,6 +54,8 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
|
||||||
String sourceDescription = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "");
|
String sourceDescription = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "");
|
||||||
bgReading.filtered = sourceDescription.equals("G5 Native");
|
bgReading.filtered = sourceDescription.equals("G5 Native");
|
||||||
if (MainApp.engineeringMode && !bgReading.filtered && bgReading.noise >= 0 && bgReading.noise <= 4) {
|
if (MainApp.engineeringMode && !bgReading.filtered && bgReading.noise >= 0 && bgReading.noise <= 4) {
|
||||||
|
// TODO syncing noice with NS is neither implemented nor tested
|
||||||
|
// * NSUpload.uploadBg
|
||||||
log.debug("Setting filtered=true, since noise is provided and passed check: " + bgReading.noise);
|
log.debug("Setting filtered=true, since noise is provided and passed check: " + bgReading.noise);
|
||||||
bgReading.filtered = true;
|
bgReading.filtered = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class SourceXdripPluginTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@Ignore("Bundle needs to be properly mocked")
|
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
|
||||||
@Test
|
@Test
|
||||||
public void bgWithUnknownSourceIsMarkedUnfiltered() {
|
public void bgWithUnknownSourceIsMarkedUnfiltered() {
|
||||||
Bundle bundle = createBroadcastBundle();
|
Bundle bundle = createBroadcastBundle();
|
||||||
|
@ -53,7 +53,7 @@ public class SourceXdripPluginTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@Ignore("Bundle needs to be properly mocked")
|
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
|
||||||
@Test
|
@Test
|
||||||
public void bgWithSourceG5NativeIsMarkedFiltered() {
|
public void bgWithSourceG5NativeIsMarkedFiltered() {
|
||||||
Bundle bundle = createBroadcastBundle();
|
Bundle bundle = createBroadcastBundle();
|
||||||
|
@ -63,6 +63,28 @@ public class SourceXdripPluginTest {
|
||||||
assertTrue(bgReadings.filtered);
|
assertTrue(bgReadings.filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
|
||||||
|
@Test
|
||||||
|
public void bgWithWithGoodNoiseIsMarkedFiltered() {
|
||||||
|
Bundle bundle = createBroadcastBundle();
|
||||||
|
bundle.putString(Intents.EXTRA_NOISE, "1.0");
|
||||||
|
|
||||||
|
BgReading bgReadings = plugin.processNewData(bundle).get(0);
|
||||||
|
assertTrue(bgReadings.filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
|
||||||
|
@Test
|
||||||
|
public void bgWithWithExcessiveNoiseDataIsMarkedFiltered() {
|
||||||
|
Bundle bundle = createBroadcastBundle();
|
||||||
|
bundle.putString(Intents.EXTRA_NOISE, "80.0");
|
||||||
|
|
||||||
|
BgReading bgReadings = plugin.processNewData(bundle).get(0);
|
||||||
|
assertTrue(bgReadings.filtered);
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Bundle createBroadcastBundle() {
|
private Bundle createBroadcastBundle() {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
Loading…
Reference in a new issue