Search in sources :

Example 1 with ModelListElement

use of com.thebluealliance.androidclient.listitems.ModelListElement in project the-blue-alliance-android by the-blue-alliance.

the class MyTbaModelRendererTest method testRenderEventTeam.

@Test
public void testRenderEventTeam() {
    Team team = ModelMaker.getModel(Team.class, TEAM_KEY);
    Event event = ModelMaker.getModel(Event.class, EVENT_KEY);
    when(mDatafeed.fetchTeam(TEAM_KEY)).thenReturn(Observable.just(team));
    when(mDatafeed.fetchEvent(EVENT_KEY)).thenReturn(Observable.just(event));
    ListItem item = mRenderer.renderFromKey(EVENT_TEAM_KEY, ModelType.EVENTTEAM, null);
    assertNotNull(item);
    assertTrue(item instanceof ModelListElement);
    assertEquals(((ModelListElement) item).getText(), "UberBots @ 2015 Hartford");
    assertEquals(((ModelListElement) item).getKey(), EVENT_TEAM_KEY);
    assertEquals(((ModelListElement) item).getType(), ModelType.EVENTTEAM);
}
Also used : Event(com.thebluealliance.androidclient.models.Event) Team(com.thebluealliance.androidclient.models.Team) ModelListElement(com.thebluealliance.androidclient.listitems.ModelListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 2 with ModelListElement

use of com.thebluealliance.androidclient.listitems.ModelListElement in project the-blue-alliance-android by the-blue-alliance.

the class MyTbaModelRendererTest method testNullMatch.

@Test
public void testNullMatch() {
    when(mDatafeed.fetchMatch(MATCH_KEY)).thenReturn(Observable.just(null));
    ListItem item = mRenderer.renderFromKey(MATCH_KEY, ModelType.MATCH, null);
    assertNotNull(item);
    assertTrue(item instanceof ModelListElement);
    assertEquals(((ModelListElement) item).getText(), "2014cmp_f1m1");
    assertEquals(((ModelListElement) item).getKey(), MATCH_KEY);
    assertEquals(((ModelListElement) item).getType(), ModelType.MATCH);
}
Also used : ModelListElement(com.thebluealliance.androidclient.listitems.ModelListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 3 with ModelListElement

use of com.thebluealliance.androidclient.listitems.ModelListElement in project the-blue-alliance-android by the-blue-alliance.

the class MyTbaModelRendererTest method testNullEventTeam.

@Test
public void testNullEventTeam() {
    when(mDatafeed.fetchTeam(TEAM_KEY)).thenReturn(Observable.just(null));
    when(mDatafeed.fetchEvent(EVENT_KEY)).thenReturn(Observable.just(null));
    ListItem item = mRenderer.renderFromKey(EVENT_TEAM_KEY, ModelType.EVENTTEAM, null);
    assertNotNull(item);
    assertTrue(item instanceof ModelListElement);
    assertEquals(((ModelListElement) item).getText(), "frc1124 @ 2015cthar");
    assertEquals(((ModelListElement) item).getKey(), EVENT_TEAM_KEY);
    assertEquals(((ModelListElement) item).getType(), ModelType.EVENTTEAM);
}
Also used : ModelListElement(com.thebluealliance.androidclient.listitems.ModelListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 4 with ModelListElement

use of com.thebluealliance.androidclient.listitems.ModelListElement in project the-blue-alliance-android by the-blue-alliance.

the class MyTbaModelRendererTest method testNullDistrict.

@Test
public void testNullDistrict() {
    when(mDatafeed.fetchDistrict(DISTRICT_KEY)).thenReturn(Observable.just(null));
    ListItem item = mRenderer.renderFromKey(DISTRICT_KEY, ModelType.DISTRICT, null);
    assertNotNull(item);
    assertTrue(item instanceof ModelListElement);
    assertEquals(((ModelListElement) item).getText(), DISTRICT_KEY);
    assertEquals(((ModelListElement) item).getKey(), DISTRICT_KEY);
    assertEquals(((ModelListElement) item).getType(), ModelType.DISTRICT);
}
Also used : ModelListElement(com.thebluealliance.androidclient.listitems.ModelListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 5 with ModelListElement

use of com.thebluealliance.androidclient.listitems.ModelListElement in project the-blue-alliance-android by the-blue-alliance.

the class MyTbaModelRendererTest method testNullTeam.

@Test
public void testNullTeam() {
    when(mDatafeed.fetchTeam(TEAM_KEY)).thenReturn(Observable.just(null));
    ListItem item = mRenderer.renderFromKey(TEAM_KEY, ModelType.TEAM, null);
    assertNotNull(item);
    assertTrue(item instanceof ModelListElement);
    assertEquals(((ModelListElement) item).getText(), "frc1124");
    assertEquals(((ModelListElement) item).getKey(), TEAM_KEY);
    assertEquals(((ModelListElement) item).getType(), ModelType.TEAM);
}
Also used : ModelListElement(com.thebluealliance.androidclient.listitems.ModelListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Aggregations

ModelListElement (com.thebluealliance.androidclient.listitems.ModelListElement)7 ListItem (com.thebluealliance.androidclient.listitems.ListItem)6 Test (org.junit.Test)6 Event (com.thebluealliance.androidclient.models.Event)2 Team (com.thebluealliance.androidclient.models.Team)2 Nullable (androidx.annotation.Nullable)1 WorkerThread (androidx.annotation.WorkerThread)1 DistrictListElement (com.thebluealliance.androidclient.listitems.DistrictListElement)1 Match (com.thebluealliance.androidclient.models.Match)1