summaryrefslogtreecommitdiff
path: root/app/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/java')
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/base/models/DefaultedURLTest.java (renamed from app/src/test/java/se/leap/bitmaskclient/DefaultedURLTest.java)4
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/base/models/ProviderTest.java (renamed from app/src/test/java/se/leap/bitmaskclient/ProviderTest.java)3
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/base/utils/PreferenceHelperTest.java (renamed from app/src/test/java/se/leap/bitmaskclient/PreferenceHelperTest.java)11
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/EipStatusTest.java7
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaySelectorTest.java8
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java19
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java35
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/providersetup/ProviderManagerTest.java (renamed from app/src/test/java/se/leap/bitmaskclient/ProviderManagerTest.java)10
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/testutils/BackendMockResponses/BaseBackendResponse.java2
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java24
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/tethering/TetheringStateManagerTest.java2
11 files changed, 62 insertions, 63 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/DefaultedURLTest.java b/app/src/test/java/se/leap/bitmaskclient/base/models/DefaultedURLTest.java
index cbf47621..551206d9 100644
--- a/app/src/test/java/se/leap/bitmaskclient/DefaultedURLTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/base/models/DefaultedURLTest.java
@@ -1,10 +1,12 @@
-package se.leap.bitmaskclient;
+package se.leap.bitmaskclient.base.models;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
+import se.leap.bitmaskclient.base.models.DefaultedURL;
+
import static org.junit.Assert.*;
/**
diff --git a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java b/app/src/test/java/se/leap/bitmaskclient/base/models/ProviderTest.java
index 8a74e5de..aaf3f255 100644
--- a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/base/models/ProviderTest.java
@@ -1,10 +1,11 @@
-package se.leap.bitmaskclient;
+package se.leap.bitmaskclient.base.models;
import org.junit.Test;
import java.util.HashSet;
import java.util.Set;
+import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.testutils.TestSetupHelper;
import static junit.framework.Assert.assertFalse;
diff --git a/app/src/test/java/se/leap/bitmaskclient/PreferenceHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/base/utils/PreferenceHelperTest.java
index edac3480..955ddc44 100644
--- a/app/src/test/java/se/leap/bitmaskclient/PreferenceHelperTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/base/utils/PreferenceHelperTest.java
@@ -1,19 +1,20 @@
-package se.leap.bitmaskclient;
+package se.leap.bitmaskclient.base.utils;
import android.content.SharedPreferences;
import org.junit.Before;
import org.junit.Test;
+import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.testutils.MockSharedPreferences;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION;
-import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
-import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString;
-import static se.leap.bitmaskclient.utils.PreferenceHelper.getSavedProviderFromSharedPreferences;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences;
/**
* Created by cyberta on 17.01.18.
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/EipStatusTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/EipStatusTest.java
index 8ba7f5fc..1e15c5ab 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/EipStatusTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/EipStatusTest.java
@@ -3,18 +3,14 @@ package se.leap.bitmaskclient.eip;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.ArgumentMatchers;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConnectionStatus;
import de.blinkt.openvpn.core.VpnStatus;
-import de.blinkt.openvpn.core.connection.Connection;
import se.leap.bitmaskclient.R;
-import se.leap.bitmaskclient.testutils.MockHelper;
-import se.leap.bitmaskclient.testutils.TestSetupHelper;
-import se.leap.bitmaskclient.utils.PreferenceHelper;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_AUTH_FAILED;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
@@ -26,7 +22,6 @@ import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INP
import static de.blinkt.openvpn.core.ConnectionStatus.UNKNOWN_LEVEL;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN;
import static junit.framework.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.powermock.api.mockito.PowerMockito.doNothing;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaySelectorTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaySelectorTest.java
index 5d5a959b..8c074dd8 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaySelectorTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaySelectorTest.java
@@ -18,15 +18,15 @@ import java.io.IOException;
import java.util.ArrayList;
import de.blinkt.openvpn.core.ConfigParser;
-import se.leap.bitmaskclient.Provider;
-import se.leap.bitmaskclient.utils.ConfigHelper;
+import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.base.utils.ConfigHelper;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
-import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
-import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString;
/**
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
index bfe96d2c..01e27320 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
@@ -18,14 +18,13 @@ import java.io.IOException;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
-import de.blinkt.openvpn.core.connection.Connection;
-import se.leap.bitmaskclient.Provider;
-import se.leap.bitmaskclient.ProviderObservable;
+import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.base.models.ProviderObservable;
import se.leap.bitmaskclient.testutils.MockHelper;
import se.leap.bitmaskclient.testutils.MockSharedPreferences;
import se.leap.bitmaskclient.testutils.TestSetupHelper;
-import se.leap.bitmaskclient.utils.ConfigHelper;
-import se.leap.bitmaskclient.utils.PreferenceHelper;
+import se.leap.bitmaskclient.base.utils.ConfigHelper;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN;
@@ -38,11 +37,11 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static se.leap.bitmaskclient.Constants.GATEWAYS;
-import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION;
-import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
-import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
-import static se.leap.bitmaskclient.Provider.CA_CERT;
+import static se.leap.bitmaskclient.base.models.Constants.GATEWAYS;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.base.models.Provider.CA_CERT;
import static se.leap.bitmaskclient.testutils.TestSetupHelper.getProvider;
/**
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
index efa6f78c..38449c20 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
@@ -40,25 +40,24 @@ import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateEncodingException;
import se.leap.bitmaskclient.BuildConfig;
-import se.leap.bitmaskclient.Provider;
-import se.leap.bitmaskclient.ProviderAPI;
-import se.leap.bitmaskclient.ProviderApiConnector;
-import se.leap.bitmaskclient.ProviderApiManager;
-import se.leap.bitmaskclient.ProviderApiManagerBase;
-import se.leap.bitmaskclient.testutils.BackendMockResponses.GeoIpServiceIsDownBackendResponse;
+import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.providersetup.ProviderAPI;
+import se.leap.bitmaskclient.providersetup.ProviderApiConnector;
+import se.leap.bitmaskclient.providersetup.ProviderApiManager;
+import se.leap.bitmaskclient.providersetup.ProviderApiManagerBase;
import se.leap.bitmaskclient.testutils.MockSharedPreferences;
-import se.leap.bitmaskclient.utils.ConfigHelper;
-import se.leap.bitmaskclient.utils.PreferenceHelper;
-
-import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY;
-import static se.leap.bitmaskclient.Constants.EIP_ACTION_START;
-import static se.leap.bitmaskclient.Constants.PROVIDER_KEY;
-import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON;
-import static se.leap.bitmaskclient.ProviderAPI.ERRORS;
-import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON;
-import static se.leap.bitmaskclient.ProviderAPI.PARAMETERS;
-import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_NOK;
-import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_OK;
+import se.leap.bitmaskclient.base.utils.ConfigHelper;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
+
+import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.PARAMETERS;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.PROVIDER_NOK;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.PROVIDER_OK;
import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.ERROR_CASE_FETCH_EIP_SERVICE_CERTIFICATE_INVALID;
import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.ERROR_CASE_MICONFIGURED_PROVIDER;
import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.ERROR_CASE_UPDATED_CERTIFICATE;
diff --git a/app/src/test/java/se/leap/bitmaskclient/ProviderManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/providersetup/ProviderManagerTest.java
index 1914f989..c48f520e 100644
--- a/app/src/test/java/se/leap/bitmaskclient/ProviderManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/providersetup/ProviderManagerTest.java
@@ -1,4 +1,4 @@
-package se.leap.bitmaskclient;
+package se.leap.bitmaskclient.providersetup;
import android.content.res.AssetManager;
@@ -16,9 +16,11 @@ import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
-import se.leap.bitmaskclient.utils.ConfigHelper;
-import se.leap.bitmaskclient.utils.FileHelper;
-import se.leap.bitmaskclient.utils.InputStreamHelper;
+import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.base.utils.ConfigHelper;
+import se.leap.bitmaskclient.base.utils.FileHelper;
+import se.leap.bitmaskclient.base.utils.InputStreamHelper;
+import se.leap.bitmaskclient.providersetup.ProviderManager;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/BackendMockResponses/BaseBackendResponse.java b/app/src/test/java/se/leap/bitmaskclient/testutils/BackendMockResponses/BaseBackendResponse.java
index 98224019..9a538d3c 100644
--- a/app/src/test/java/se/leap/bitmaskclient/testutils/BackendMockResponses/BaseBackendResponse.java
+++ b/app/src/test/java/se/leap/bitmaskclient/testutils/BackendMockResponses/BaseBackendResponse.java
@@ -25,7 +25,7 @@ import org.mockito.stubbing.Answer;
import java.io.IOException;
import okhttp3.OkHttpClient;
-import se.leap.bitmaskclient.ProviderApiConnector;
+import se.leap.bitmaskclient.providersetup.ProviderApiConnector;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java
index d3d07308..d4b7c5d1 100644
--- a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java
+++ b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java
@@ -34,16 +34,16 @@ import java.util.Map;
import java.util.Set;
import okhttp3.OkHttpClient;
-import se.leap.bitmaskclient.OkHttpClientGenerator;
-import se.leap.bitmaskclient.Provider;
-import se.leap.bitmaskclient.ProviderObservable;
+import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator;
+import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.base.models.ProviderObservable;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider;
import se.leap.bitmaskclient.testutils.matchers.BundleMatcher;
-import se.leap.bitmaskclient.utils.ConfigHelper;
-import se.leap.bitmaskclient.utils.FileHelper;
-import se.leap.bitmaskclient.utils.InputStreamHelper;
-import se.leap.bitmaskclient.utils.PreferenceHelper;
+import se.leap.bitmaskclient.base.utils.ConfigHelper;
+import se.leap.bitmaskclient.base.utils.FileHelper;
+import se.leap.bitmaskclient.base.utils.InputStreamHelper;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -57,11 +57,11 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
-import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
-import static se.leap.bitmaskclient.utils.FileHelper.createFile;
-import static se.leap.bitmaskclient.utils.PreferenceHelper.getEipDefinitionFromPreferences;
-import static se.leap.bitmaskclient.utils.PreferenceHelper.getFromPersistedProvider;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.base.utils.FileHelper.createFile;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getEipDefinitionFromPreferences;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getFromPersistedProvider;
/**
* Created by cyberta on 29.01.18.
diff --git a/app/src/test/java/se/leap/bitmaskclient/tethering/TetheringStateManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/tethering/TetheringStateManagerTest.java
index b3ab75ba..509805d4 100644
--- a/app/src/test/java/se/leap/bitmaskclient/tethering/TetheringStateManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/tethering/TetheringStateManagerTest.java
@@ -36,7 +36,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
-import se.leap.bitmaskclient.utils.Cmd;
+import se.leap.bitmaskclient.base.utils.Cmd;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;