diff options
author | cyBerta <cyberta@riseup.net> | 2024-11-15 13:11:13 +0100 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2024-12-11 00:09:34 +0000 |
commit | 5682720dd0113ae3701df97cb15088ead9b231d8 (patch) | |
tree | bec6857454f5eb3ee93ab7c816b818c645ea2a09 /app/src/test/java/io/swagger/client/JSONTest.java | |
parent | aa780e9698e0aa564ff925d4d17a59e6db67ec6b (diff) |
fix tests
Diffstat (limited to 'app/src/test/java/io/swagger/client/JSONTest.java')
-rw-r--r-- | app/src/test/java/io/swagger/client/JSONTest.java | 31 |
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); + } +} |