Search in sources :

Example 1 with GameStatus

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

the class GameStatusTypeAdapterTest method testReadGibberish.

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

Example 2 with GameStatus

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

the class GameStatusTypeAdapterTest method testReadNull.

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

Example 3 with GameStatus

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

the class GameStatusTypeAdapterTest method testRead.

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

Aggregations

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