summaryrefslogtreecommitdiff
path: root/app/src/test/java/io/swagger/client/JSONTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/java/io/swagger/client/JSONTest.java')
-rw-r--r--app/src/test/java/io/swagger/client/JSONTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/src/test/java/io/swagger/client/JSONTest.java b/app/src/test/java/io/swagger/client/JSONTest.java
new file mode 100644
index 00000000..5baa7e79
--- /dev/null
+++ b/app/src/test/java/io/swagger/client/JSONTest.java
@@ -0,0 +1,31 @@
+package io.swagger.client;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import static org.junit.Assert.*;
+
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
+
+import com.google.gson.JsonSyntaxException;
+
+import de.blinkt.openvpn.core.ConfigParser;
+import io.swagger.client.model.ModelsProvider;
+import se.leap.bitmaskclient.testutils.TestSetupHelper;
+
+public class JSONTest {
+
+ @Test
+ public void testProviderJsonParsing_testBackwardsCompatibility_v4() throws IOException {
+ String boblove = TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/riseup.net.json"));
+ ModelsProvider p = JSON.createGson().create().fromJson(boblove, ModelsProvider.class);
+ assertNotNull(p);
+ assertEquals("riseup.net", p.getDomain());
+ }
+
+ @Test
+ public void testProvidingNull() throws IOException {
+ String p = JSON.createGson().create().toJson(null);
+ assertEquals("null", p);
+ }
+}