AbstractSensitivityPlugin extends PluginBase implements SensitivityInterface { AutosensResult fillResult(double ratio, double carbsAbsorbed, String pastSensitivity, String ratioLimit, String sensResult, int deviationsArraySize) { return this.fillResult(ratio, carbsAbsorbed, pastSensitivity, ratioLimit, sensResult, deviationsArraySize, SafeParse.stringToDouble(SP.getString(R.string.key_openapsama_autosens_min, "0.7")), SafeParse.stringToDouble(SP.getString(R.string.key_openapsama_autosens_max, "1.2"))); } AbstractSensitivityPlugin(PluginDescription pluginDescription); @Override abstract AutosensResult detectSensitivity(IobCobCalculatorPlugin plugin, long fromTime, long toTime); AutosensResult fillResult(double ratio, double carbsAbsorbed, String pastSensitivity,
                                     String ratioLimit, String sensResult, int deviationsArraySize,
                                     double ratioMin, double ratioMax);  }
@Test public void fillResultTest() { AAPSMocker.mockMainApp(); AAPSMocker.mockApplicationContext(); AAPSMocker.mockSP(); SensitivityTestClass sut = new SensitivityTestClass(); AutosensResult ar = sut.fillResult(1d, 1d, "1", "1.2", "1", 12, 0.7d, 1.2d); assertEquals(1, ar.ratio, 0.01); ar = sut.fillResult(1.2d, 1d, "1", "1.2", "1", 40, 0.7d, 1.2d); assertEquals(1.16, ar.ratio, 0.01); ar = sut.fillResult(1.2d, 1d, "1", "1.2", "1", 50, 0.7d, 1.2d); assertEquals(1.2, ar.ratio, 0.01); ar = sut.fillResult(1.2d, 1d, "1", "1.2", "1", 50, 0.7d, 1.1d); assertEquals(1.1, ar.ratio, 0.01); }