Search in sources :

Example 11 with ListItem

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

the class MyTbaModelRendererTest method testRenderDistrict.

@Test
public void testRenderDistrict() {
    District district = ModelMaker.getModelList(District.class, "2015_districts").get(3);
    district.setYear(2015);
    when(mDatafeed.fetchDistrict(DISTRICT_KEY)).thenReturn(Observable.just(district));
    ListItem item = mRenderer.renderFromKey(DISTRICT_KEY, ModelType.DISTRICT, null);
    verify(mDistrictRenderer).renderFromKey(eq(DISTRICT_KEY), eq(ModelType.DISTRICT), anyObject());
}
Also used : ListItem(com.thebluealliance.androidclient.listitems.ListItem) District(com.thebluealliance.androidclient.models.District) Test(org.junit.Test)

Example 12 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem 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 13 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem 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 14 with ListItem

use of com.thebluealliance.androidclient.listitems.ListItem 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 15 with ListItem

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

the class AwardsListSubscriberTest method assertItemsEqual.

private void assertItemsEqual(int rawIndex, int sortedIndex) {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mAwards);
    CardedAwardListElement element = (CardedAwardListElement) data.get(sortedIndex);
    Award award = mAwards.get(rawIndex);
    assertEquals(element.mAwardName, award.getName());
    assertEquals(element.mEventKey, award.getEventKey());
    assertEquals(element.mSelectedTeamNum, "");
    assertTrue(element.mAwardWinners.equals(award.getRecipientList()));
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) Award(com.thebluealliance.androidclient.models.Award) ListItem(com.thebluealliance.androidclient.listitems.ListItem)

Aggregations

ListItem (com.thebluealliance.androidclient.listitems.ListItem)26 Test (org.junit.Test)18 ModelListElement (com.thebluealliance.androidclient.listitems.ModelListElement)6 CardedAwardListElement (com.thebluealliance.androidclient.listitems.CardedAwardListElement)5 Award (com.thebluealliance.androidclient.models.Award)3 Team (com.thebluealliance.androidclient.models.Team)3 ListViewAdapter (com.thebluealliance.androidclient.adapters.ListViewAdapter)2 DistrictTeamListElement (com.thebluealliance.androidclient.listitems.DistrictTeamListElement)2 EventTypeHeader (com.thebluealliance.androidclient.listitems.EventTypeHeader)2 LabelValueListItem (com.thebluealliance.androidclient.listitems.LabelValueListItem)2 Event (com.thebluealliance.androidclient.models.Event)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Cursor (android.database.Cursor)1 JsonObject (com.google.gson.JsonObject)1 EventAwardsEvent (com.thebluealliance.androidclient.eventbus.EventAwardsEvent)1 RenderableModel (com.thebluealliance.androidclient.interfaces.RenderableModel)1 ContributorListElement (com.thebluealliance.androidclient.listitems.ContributorListElement)1 DividerListItem (com.thebluealliance.androidclient.listitems.DividerListItem)1 EmptyListElement (com.thebluealliance.androidclient.listitems.EmptyListElement)1