extract key_virtualpump_type

This commit is contained in:
Milos Kozak 2018-08-23 18:46:06 +02:00
parent 243755d1b1
commit b0f8ab9922
4 changed files with 7 additions and 8 deletions

View file

@ -427,7 +427,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
public void refreshConfiguration()
{
String pumptype = SP.getString("virtualpump_type", "Generic AAPS");
String pumptype = SP.getString(R.string.key_virtualpump_type, "Generic AAPS");
PumpType pumpTypeNew = PumpType.getByDescription(pumptype);

View file

@ -1083,6 +1083,7 @@
<string name="openapsama_max_daily_safety_multiplier">Max daily safety multiplier</string>
<string name="openapsama_current_basal_safety_multiplier">Current basal safety multiplier</string>
<string name="value_unavailable_short">n/a</string>
<string translatable="false" name="key_virtualpump_type">virtualpump_type</string>
<string name="virtualpump_type">Virtual Pump Type</string>
<string name="virtualpump_definition">Pump Definition</string>
<string name="virtualpump_pump_def">Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s</string>

View file

@ -13,7 +13,7 @@
android:defaultValue="1"
android:entries="@array/virtualPumpTypes"
android:entryValues="@array/virtualPumpTypes"
android:key="virtualpump_type"
android:key="@string/key_virtualpump_type"
android:title="@string/virtualpump_type" />
</PreferenceCategory>

View file

@ -6,19 +6,17 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.PumpCommon.defs.PumpType;
import info.nightscout.androidaps.plugins.PumpInsight.InsightPlugin;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
import static org.junit.Assert.*;
import static org.powermock.api.mockito.PowerMockito.when;
/**
@ -53,7 +51,7 @@ public class VirtualPumpPluginUTest {
@Test
public void refreshConfiguration() throws Exception {
when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo");
when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo");
virtualPumpPlugin.refreshConfiguration();
@ -64,11 +62,11 @@ public class VirtualPumpPluginUTest {
@Test
public void refreshConfigurationTwice() throws Exception {
when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo");
when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo");
virtualPumpPlugin.refreshConfiguration();
when(SP.getString("virtualpump_type", "Generic AAPS")).thenReturn("Accu-Chek Combo");
when(SP.getString(R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo");
virtualPumpPlugin.refreshConfiguration();