@Config(constants=BuildConfig.class, sdk=23, packageName="com.eu.pepper.safetysystem", manifest="--none") public class SafetySystemUnitTests extends java.lang.Object
Constructor and Description |
---|
SafetySystemUnitTests() |
Modifier and Type | Method and Description |
---|---|
static org.json.JSONObject |
p6() |
static org.json.JSONObject |
p62() |
static org.json.JSONObject |
p6Case() |
void |
runBefore() |
void |
testAddCarbs1()
From an initial state with 0 carbohydrates on board, add 60 carbohydrates and check
getCarbsOnBoard() returns ~60.
|
void |
testAddCarbs2()
Check an IllegalSafetySystemStateException is thrown if addCarbs() is called prior to
initialization of the safety system.
|
void |
testAddInsulin1()
From an initial state with 0 insulin on board, add 4.9 insulin units and check
getInsulinOnBoard() returns ~4.9.
|
void |
testAddInsulin2()
Check an IllegalSafetySystemStateException is thrown if addInsulin() is called prior to
initialization of the safety system.
|
void |
testConstrain() |
void |
testCurrentICR1()
Test successful retrieval of the value at the earliest time interval.
|
void |
testCurrentICR2()
Test successful retrieval of the value at the latest time interval.
|
void |
testCurrentICR3()
Test successful retrieval of the value at the middle time interval.
|
void |
testCurrentICR4()
Test successful retrieval of the value on the boundary of a time interval.
|
void |
testCurrentICR5()
Test successful retrieval of the value on the boundary of a time interval.
|
void |
testCurrentICR6()
Test IllegalSafetySystemStateException is thrown if trying to call getCurrentICR()
when the Safety System has not been initialized.
|
void |
testCurrentISF1()
Test successful retrieval of the value at the earliest time interval.
|
void |
testCurrentISF2()
Test successful retrieval of the value at the latest time interval.
|
void |
testCurrentISF3()
Test successful retrieval of the value at the middle time interval.
|
void |
testCurrentISF4()
Test successful retrieval of the value on the boundary of a time interval.
|
void |
testCurrentISF5()
Test successful retrieval of the value on the boundary of a time interval.
|
void |
testCurrentISF6()
Test IllegalSafetySystemStateException is thrown if trying to call getCurrentISF()
when the Safety System has not been initialized.
|
void |
testGlucoseAlarm1a()
Test that no glucose alarm is returned when a glucose update of 300 mg/dL with a
boundary of 300 mg/dL
|
void |
testGlucoseAlarm1b()
Test that no glucose alarm is returned when a glucose update of 70 mg/dL with a
boundary of 70 mg/dL
|
void |
testGlucoseAlarm1c()
Test that no glucose alarm is returned when a glucose update of 301 mg/dL at 0 minutes
and blood glucose update of 300 mg/dL at 60 minutes and a glucose update of 301 mg/dL at
121 minutes for a boundary of 300 mg/dL.
|
void |
testGlucoseAlarm1d()
Test that no glucose alarm is returned when a glucose update of 69 mg/dL at 0 minutes
and blood glucose update of 70 mg/dL at 60 minutes and a glucose update of 69 mg/dL at
121 minutes for a boundary of 70 mg/dL.
|
void |
testGlucoseAlarm2a()
Test for glucose hyper alarm when a blood glucose update of 301 mg/dL is passed
to the safety system (boundary 300 mg/dL).
|
void |
testGlucoseAlarm2b()
Test for no glucose hyper alarm when a blood glucose update of 301 mg/dL is passed
to the safety system and the safety system in inactive (boundary 300 mg/dL).
|
void |
testGlucoseAlarm3a()
Test for glucose hypo alarm when a blood glucose update of 69 mg/dL is passed
to the safety system (boundary 70 mg/dL).
|
void |
testGlucoseAlarm3b()
Test for no glucose hypo alarm when a blood glucose update of 69 mg/dL is passed
to the safety system and the safety system in inactive (boundary 70 mg/dL).
|
void |
testGlucoseAlarm4a()
Test an IllegalSafetySystemStateException is thrown if getGlucoseAlarm is invoked
prior to initializing the safety system.
|
void |
testGlucoseAlarm4b()
Test an IllegalSafetySystemStateException is thrown if hasGlucoseAlarm is invoked
prior to initializing the safety system.
|
void |
testInitSafetySystem1()
Test valid JSONObject and ensure the Safety System is initialised and no exceptions are
thrown
|
void |
testInitSafetySystem10()
Test for different lengths of IsfSafety and TimeIsfSafety and ensure the Safety System is
not initialised
|
void |
testInitSafetySystem11()
Test for a null JSONObject and ensure the Safety System
is not initialized
|
void |
testInitSafetySystem2()
Test invalid JSONObject attribute key and ensure the Safety System is not initialised and a JSONException
is thrown
|
void |
testInitSafetySystem3()
Test invalid JSONObject attribute value and ensure the Safety System is not initialised
|
void |
testInitSafetySystem4()
Test invalid JSONObject attribute value and ensure the Safety System is not initialised
|
void |
testInitSafetySystem5()
Test the attribute IcfSafety for no values and ensure the Safety System is not initialised
|
void |
testInitSafetySystem6()
Test the attribute TimeIcfSafety for no values and ensure the Safety System is not initialised
|
void |
testInitSafetySystem7()
Test the attribute IsfSafety for no values and ensure the Safety System is not initialised
|
void |
testInitSafetySystem8()
Test the attribute TimeIsfSafety for no values
|
void |
testInitSafetySystem9()
Test for different lengths of IcrSafety and TimeIcrSafety and ensure the Safety System is
not initialised
|
void |
testLowGlucoseSuspension1()
Test for no suspension with a blood glucose update of 90 mg/dL (90 mg/dL threshold)
|
void |
testLowGlucoseSuspension2()
Test for full suspension by updating the safety system with 69 mg/dL blood glucose updates
until getGlucoseForecast() is less than the total suspension threshold of 70 mg/dL then
update the safety system with values of 81 mg/dL until getGlucoseForecast() returns a
forecasted blood glucose >= 81 mg/dL, then test for no suspension (81 mg/dL threshold).
|
void |
testLowGlucoseSuspension3()
Test for partial suspension by updating the safety system with 80 mg/dL blood glucose updates
until getGlucoseForecast() is less than the partial suspension threshold of
81 mg/dL.
|
void |
testLowGlucoseSuspension4()
Test for total suspension by updating the safety system with 69 mg/dL blood glucose updates
until getGlucoseForecast() is less than the partial suspension threshold of
70 mg/dL.
|
void |
testLowGlucoseSuspension5()
Test for full suspension by updating the safety system with 69 mg/dL blood glucose updates
until getGlucoseForecast() is less than the total suspension threshold of 70 mg/dL then
update the safety system with values of 171 mg/dL until getGlucoseForecast() returns a
forecasted blood glucose > 70 mg/dL, then steady the derivative by updating the safety system
with 71 mg/dL, thentest for partial suspension (> 71 mg/dL threshold).
|
void |
testLowGlucoseSuspension6()
Test that total low glucose suspension changes to partial after 90 minutes in total suspension.
|
void |
testLowGlucoseSuspension7()
Test that total low glucose suspension does not change to partial if 90 minutes in total
suspension has not elapsed.
|
void |
testLowGlucoseSuspension8()
Test that total low glucose suspension reverts back to full suspension after 90 + 30 mins.
|
void |
testSetHyperThreshold1()
From the initial state use setHyperThreshold(double hyperThreshold) to set the
hyperglycemia threshold to 200 mg/dL and ensure that getHyperThreshold() returns 200 mg/dL
(default 160 mg/dL)
|
void |
testSetHyperThreshold2()
IllegalSafetySystemStateException should be thrown if the Safety System is not initialised
prior to calling SafetySystem.setHyperThreshold(double hyperThreshold)
|
void |
testSetHyperThreshold3()
IllegalSafetySystemStateException should be thrown if the Safety System is not initialised
prior to calling SafetySystem.getHyperThreshold()
|
void |
testSetHypoThreshold1()
From the initial state use setHypoThreshold(double hypoThreshold) to set the
hypoglycemia threshold to 80 mg/dL and ensure that getHypoThreshold() returns 80 mg/dL
(default 70 mg/dL)
|
void |
testSetHypoThreshold2()
IllegalSafetySystemStateException should be thrown if the Safety System is not initialised
prior to calling SafetySystem.setHypoThreshold(double hypoThreshold)
|
void |
testSetHypoThreshold3()
IllegalSafetySystemStateException should be thrown if the Safety System is not initialised
prior to calling SafetySystem.getHypoThreshold()
|
public void runBefore()
public void testConstrain() throws org.json.JSONException, java.text.ParseException
org.json.JSONException
java.text.ParseException
public static org.json.JSONObject p6() throws org.json.JSONException
org.json.JSONException
public static org.json.JSONObject p62() throws org.json.JSONException
org.json.JSONException
public static org.json.JSONObject p6Case() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem1() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem2() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem3() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem4() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem5() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem6() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem7() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem8() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem9() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem10() throws org.json.JSONException
org.json.JSONException
public void testInitSafetySystem11() throws org.json.JSONException
org.json.JSONException
public void testSetHyperThreshold1() throws org.json.JSONException
org.json.JSONException
public void testSetHyperThreshold2() throws org.json.JSONException
org.json.JSONException
public void testSetHyperThreshold3() throws org.json.JSONException
org.json.JSONException
public void testSetHypoThreshold1() throws org.json.JSONException
org.json.JSONException
public void testSetHypoThreshold2() throws org.json.JSONException
org.json.JSONException
public void testSetHypoThreshold3() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR1() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR2() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR3() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR4() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR5() throws org.json.JSONException
org.json.JSONException
public void testCurrentICR6()
public void testCurrentISF1() throws org.json.JSONException
org.json.JSONException
public void testCurrentISF2() throws org.json.JSONException
org.json.JSONException
public void testCurrentISF3() throws org.json.JSONException
org.json.JSONException
public void testCurrentISF4() throws org.json.JSONException
org.json.JSONException
public void testCurrentISF5() throws org.json.JSONException
org.json.JSONException
public void testCurrentISF6()
public void testAddCarbs1() throws org.json.JSONException
org.json.JSONException
public void testAddCarbs2()
public void testAddInsulin1() throws org.json.JSONException
org.json.JSONException
public void testAddInsulin2()
public void testGlucoseAlarm1a() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm1b() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm1c() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm1d() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm2a() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm2b() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm3a() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm3b() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm4a() throws org.json.JSONException
org.json.JSONException
public void testGlucoseAlarm4b() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension1() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension2() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension3() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension4() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension5() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension6() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension7() throws org.json.JSONException
org.json.JSONException
public void testLowGlucoseSuspension8() throws org.json.JSONException
org.json.JSONException