Test stubs.

This commit is contained in:
Johannes Mockenhaupt 2018-06-23 11:35:01 +02:00
parent c18effd893
commit 6d437b4afa
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 26 additions and 2 deletions

View file

@ -54,6 +54,8 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface {
String sourceDescription = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "");
bgReading.filtered = sourceDescription.equals("G5 Native");
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);
bgReading.filtered = true;
}

View file

@ -44,7 +44,7 @@ public class SourceXdripPluginTest {
}
// TODO
@Ignore("Bundle needs to be properly mocked")
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
@Test
public void bgWithUnknownSourceIsMarkedUnfiltered() {
Bundle bundle = createBroadcastBundle();
@ -53,7 +53,7 @@ public class SourceXdripPluginTest {
}
// TODO
@Ignore("Bundle needs to be properly mocked")
@Ignore("Bundle needs to be properly mocked or Robolectrics issues with SQLite resolved")
@Test
public void bgWithSourceG5NativeIsMarkedFiltered() {
Bundle bundle = createBroadcastBundle();
@ -63,6 +63,28 @@ public class SourceXdripPluginTest {
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
private Bundle createBroadcastBundle() {
Bundle bundle = new Bundle();