Search in sources :

Example 1 with GameAccess

use of com.faforever.client.remote.domain.GameAccess in project downlords-faf-client by FAForever.

the class GameAccessTypeAdapterTest method testReadNull.

@Test
public void testReadNull() throws Exception {
    JsonReader in = mock(JsonReader.class);
    when(in.nextString()).thenReturn(null);
    GameAccess gameAccess = instance.read(in);
    Assert.assertNull(gameAccess);
}
Also used : GameAccess(com.faforever.client.remote.domain.GameAccess) JsonReader(com.google.gson.stream.JsonReader) Test(org.junit.Test)

Example 2 with GameAccess

use of com.faforever.client.remote.domain.GameAccess in project downlords-faf-client by FAForever.

the class GameAccessTypeAdapterTest method testRead.

@Test
public void testRead() throws Exception {
    JsonReader in = mock(JsonReader.class);
    when(in.nextString()).thenReturn(GameAccess.PASSWORD.getString());
    GameAccess gameAccess = instance.read(in);
    assertEquals(GameAccess.PASSWORD, gameAccess);
}
Also used : GameAccess(com.faforever.client.remote.domain.GameAccess) JsonReader(com.google.gson.stream.JsonReader) Test(org.junit.Test)

Example 3 with GameAccess

use of com.faforever.client.remote.domain.GameAccess in project downlords-faf-client by FAForever.

the class GameAccessTypeAdapterTest method testReadGibberish.

@Test
public void testReadGibberish() throws Exception {
    JsonReader in = mock(JsonReader.class);
    when(in.nextString()).thenReturn("gibberish");
    GameAccess gameAccess = instance.read(in);
    Assert.assertNull(gameAccess);
}
Also used : GameAccess(com.faforever.client.remote.domain.GameAccess) JsonReader(com.google.gson.stream.JsonReader) Test(org.junit.Test)

Aggregations

GameAccess (com.faforever.client.remote.domain.GameAccess)3 JsonReader (com.google.gson.stream.JsonReader)3 Test (org.junit.Test)3