Search in sources :

Example 16 with ListItem

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

the class AwardsListSubscriberTest method testParse.

@Test
public void testParse() {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mAwards);
    assertEquals(data.size(), 21);
    for (int i = 0; i < data.size(); i++) {
        assertTrue(data.get(i) instanceof CardedAwardListElement);
    }
    // Test EventBus posting
    assertTrue(mSubscriber.shouldPostToEventBus());
    EventBus eventBus = mock(EventBus.class);
    mSubscriber.postToEventBus(eventBus);
    verify(eventBus).post(any(EventAwardsEvent.class));
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) EventAwardsEvent(com.thebluealliance.androidclient.eventbus.EventAwardsEvent) ListItem(com.thebluealliance.androidclient.listitems.ListItem) EventBus(org.greenrobot.eventbus.EventBus) Test(org.junit.Test)

Example 17 with ListItem

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

the class ContributorListSubscriberTest method testParsedData.

@Test
public void testParsedData() {
    List<ListItem> parsed = DatafeedTestDriver.getParsedData(mSubscriber, mData);
    assertEquals(1, parsed.size());
    assertTrue(parsed.get(0) instanceof ContributorListElement);
    ContributorListElement element = (ContributorListElement) parsed.get(0);
    assertEquals("phil-lopreiato", element.username);
    assertEquals(1266, element.contributionCount);
    assertEquals("https://avatars.githubusercontent.com/u/2754863?v=3", element.avatarUrl);
}
Also used : ContributorListElement(com.thebluealliance.androidclient.listitems.ContributorListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 18 with ListItem

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

the class DistrictPointsListSubscriberTest method testParseInvalidJson.

@Test
public void testParseInvalidJson() {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, new JsonObject());
    assertNotNull(data);
    assertEquals(data.size(), 0);
}
Also used : JsonObject(com.google.gson.JsonObject) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 19 with ListItem

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

the class DistrictPointsListSubscriberTest method testParseNonDistrict.

@Test
public void testParseNonDistrict() {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mPoints);
    DistrictTeamListElement element = new DistrictTeamListElement("frc1124", "", "Team 1124", 1, 87);
    assertNotNull(data);
    assertEquals(data.size(), 1);
    assertTrue(element.equals(data.get(0)));
}
Also used : ListItem(com.thebluealliance.androidclient.listitems.ListItem) DistrictTeamListElement(com.thebluealliance.androidclient.listitems.DistrictTeamListElement) Test(org.junit.Test)

Example 20 with ListItem

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

the class DistrictRankingsSubscriberTest method testParse.

@Test
public void testParse() {
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mDistrictTeams);
    DistrictTeamListElement element = new DistrictTeamListElement("frc1124", "2015ne", "Team 1124", 26, 157);
    assertNotNull(data);
    assertEquals(data.size(), 179);
    assertTrue(data.get(25).equals(element));
}
Also used : ListItem(com.thebluealliance.androidclient.listitems.ListItem) DistrictTeamListElement(com.thebluealliance.androidclient.listitems.DistrictTeamListElement) Test(org.junit.Test)

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