summaryrefslogtreecommitdiff
path: root/app/src/test/java/se
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/java/se')
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/base/utils/ConfigHelperTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/base/utils/ConfigHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/base/utils/ConfigHelperTest.java
index 6e0ceb56..c6387165 100644
--- a/app/src/test/java/se/leap/bitmaskclient/base/utils/ConfigHelperTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/base/utils/ConfigHelperTest.java
@@ -1,6 +1,7 @@
package se.leap.bitmaskclient.base.utils;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
@@ -11,6 +12,12 @@ import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import java.io.IOException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import se.leap.bitmaskclient.testutils.TestSetupHelper;
+
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(DataProviderRunner.class)
public class ConfigHelperTest {
@@ -57,4 +64,19 @@ public class ConfigHelperTest {
assertEquals("domain.co.uk", ConfigHelper.getDomainFromMainURL("https://subdomain.domain.co.uk"));
assertEquals("domain.co.uk", ConfigHelper.getDomainFromMainURL("https://domain.co.uk"));
}
+
+ @Test
+ public void testParseX509CertificatesFromString() throws IOException {
+ ArrayList<X509Certificate> certs = ConfigHelper.parseX509CertificatesFromString(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("updated_cert.pem")));
+ assertTrue(certs != null);
+ }
+
+ @Test
+ public void testParseX509CertificatesToString() throws IOException {
+ String certsString = TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("updated_cert.pem"));
+ ArrayList<X509Certificate> certs = ConfigHelper.parseX509CertificatesFromString(certsString);
+ String parsedCerts = ConfigHelper.parseX509CertificatesToString(certs);
+ assertEquals(certsString, parsedCerts);
+ }
+
} \ No newline at end of file