summaryrefslogtreecommitdiff
path: root/app/src/test/java/io/swagger/client/JSONTest.java
blob: 5baa7e790dd327268b318193def4f5c79aa9eda1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
    }
}