From 153e35707ed2854d89c61fdb9f82a6e9ec0db9cc Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Sat, 13 Jan 2018 17:03:14 +0100 Subject: more static constant import and import cleanup --- .../java/se/leap/bitmaskclient/test/TestEIP.java | 25 +++++++++++++--------- .../bitmaskclient/test/TestGatewaysManager.java | 5 +++-- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'app/src/androidTest') diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java index fc763c7d..4c215360 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java @@ -17,12 +17,17 @@ package se.leap.bitmaskclient.test; -import android.content.*; -import android.test.*; -import android.test.suitebuilder.annotation.*; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.test.ServiceTestCase; +import android.test.suitebuilder.annotation.MediumTest; -import se.leap.bitmaskclient.*; -import se.leap.bitmaskclient.eip.*; +import se.leap.bitmaskclient.eip.EIP; + +import static se.leap.bitmaskclient.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; +import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; /** * @author parmegv @@ -37,7 +42,7 @@ public class TestEIP extends ServiceTestCase { super(activityClass); context = getSystemContext(); intent = new Intent(context, EIP.class); - preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE); + preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); } @Override @@ -59,14 +64,14 @@ public class TestEIP extends ServiceTestCase { } private void testEmptyCertificate() { - preferences.edit().putString(Constants.PROVIDER_VPN_CERTIFICATE, "").apply(); - startService(Constants.EIP_ACTION_CHECK_CERT_VALIDITY); + preferences.edit().putString(PROVIDER_VPN_CERTIFICATE, "").apply(); + startService(EIP_ACTION_CHECK_CERT_VALIDITY); } private void testExpiredCertificate() { String expired_certificate = "expired certificate"; - preferences.edit().putString(Constants.PROVIDER_VPN_CERTIFICATE, expired_certificate).apply(); - startService(Constants.EIP_ACTION_CHECK_CERT_VALIDITY); + preferences.edit().putString(PROVIDER_VPN_CERTIFICATE, expired_certificate).apply(); + startService(EIP_ACTION_CHECK_CERT_VALIDITY); } private void startService(String action) { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java index b8cc9715..02c521be 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java @@ -25,9 +25,10 @@ import org.json.*; import java.io.IOException; import java.util.Arrays; -import se.leap.bitmaskclient.Constants; import se.leap.bitmaskclient.eip.*; +import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; + /** * @author parmegv */ @@ -109,7 +110,7 @@ public class TestGatewaysManager extends InstrumentationTestCase { private void mockGatewaysManager() { context = getInstrumentation().getContext(); - preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE); + preferences = context.getSharedPreferences(SHARED_PREFERENCES, Activity.MODE_PRIVATE); gateways_manager = new GatewaysManager(context, preferences); } -- cgit v1.2.3