diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-02-06 18:06:38 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-02-06 18:06:38 +0100 |
commit | 43fd861a1404293185bced6095410900c2417b65 (patch) | |
tree | 03326353b89b6327024ee0ee03b03b622e753279 /app/src/test/java/se/leap | |
parent | 8bb96b0116994897ca75ad8eb1d6c412e7d3ce40 (diff) | |
parent | edd34192484f4eb618fdcc2a68b18168c155d63c (diff) |
8827 - remove UserStatus references
Diffstat (limited to 'app/src/test/java/se/leap')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java | 4 | ||||
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java | 16 | ||||
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java (renamed from app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java) | 42 |
3 files changed, 13 insertions, 49 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java index a9a5733d..84f38086 100644 --- a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java @@ -6,9 +6,9 @@ import org.junit.Before; import org.junit.Test; import se.leap.bitmaskclient.testutils.MockSharedPreferences; -import se.leap.bitmaskclient.testutils.TestSetupHelper; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString; 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 a6f30393..aeb7e8c1 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java @@ -53,14 +53,14 @@ import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_OK; import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.ERROR_CASE_UPDATED_CERTIFICATE; import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.NO_ERROR; import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockBundle; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockClientGenerator; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockFingerprintForCertificate; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockIntent; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockProviderApiConnector; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockResources; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockResultReceiver; -import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockTextUtils; +import static se.leap.bitmaskclient.testutils.MockHelper.mockBundle; +import static se.leap.bitmaskclient.testutils.MockHelper.mockClientGenerator; +import static se.leap.bitmaskclient.testutils.MockHelper.mockFingerprintForCertificate; +import static se.leap.bitmaskclient.testutils.MockHelper.mockIntent; +import static se.leap.bitmaskclient.testutils.MockHelper.mockProviderApiConnector; +import static se.leap.bitmaskclient.testutils.MockHelper.mockResources; +import static se.leap.bitmaskclient.testutils.MockHelper.mockResultReceiver; +import static se.leap.bitmaskclient.testutils.MockHelper.mockTextUtils; /** diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java index 99febeb3..ea7f9aae 100644 --- a/app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java +++ b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java @@ -1,20 +1,3 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - package se.leap.bitmaskclient.testutils; import android.content.Intent; @@ -30,10 +13,8 @@ import org.json.JSONObject; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; @@ -65,25 +46,10 @@ import static org.mockito.Mockito.when; import static org.powermock.api.mockito.PowerMockito.mockStatic; /** - * Created by cyberta on 08.10.17. + * Created by cyberta on 29.01.18. */ -public class TestSetupHelper { - - - - public static String getInputAsString(InputStream fileAsInputStream) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(fileAsInputStream)); - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - while (line != null) { - sb.append(line); - line = br.readLine(); - } - - return sb.toString(); - } - +public class MockHelper { @NonNull public static Bundle mockBundle() { final Map<String, Boolean> fakeBooleanBundle = new HashMap<>(); @@ -335,7 +301,6 @@ public class TestSetupHelper { }); } - public static ResultReceiver mockResultReceiver(final int expectedResultCode, final Bundle expectedBundle) { ResultReceiver resultReceiver = mock(ResultReceiver.class); @@ -395,7 +360,7 @@ public class TestSetupHelper { public static Resources mockResources(InputStream inputStream) throws IOException, JSONException { Resources mockedResources = mock(Resources.class, RETURNS_DEEP_STUBS); - JSONObject errorMessages = new JSONObject(getInputAsString(inputStream)); + JSONObject errorMessages = new JSONObject(TestSetupHelper.getInputAsString(inputStream)); when(mockedResources.getString(R.string.warning_corrupted_provider_details)). @@ -430,5 +395,4 @@ public class TestSetupHelper { thenReturn(errorMessages.getString("warning_expired_provider_cert")); return mockedResources; } - } |