Search in sources :

Example 1 with CardedAwardListElement

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

the class AwardsListSubscriberTest method testSelectedTeam.

@Test
public void testSelectedTeam() {
    mSubscriber.setTeamKey("frc195");
    List<ListItem> data = DatafeedTestDriver.getParsedData(mSubscriber, mAwards);
    CardedAwardListElement element = (CardedAwardListElement) data.get(0);
    assertEquals(element.mSelectedTeamNum, "195");
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 2 with CardedAwardListElement

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

the class AwardRendererTest method testRenderIndividualCarded.

@Test
public void testRenderIndividualCarded() {
    Award award = ModelMaker.getModel(Award.class, AWARD_INDIVIDUAL);
    ListItem rendered = mRenderer.renderFromModel(award, new AwardRenderer.RenderArgs(new HashMap<>(), null));
    assertNotNull(rendered);
    assertTrue(rendered instanceof CardedAwardListElement);
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) HashMap(java.util.HashMap) Award(com.thebluealliance.androidclient.models.Award) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Example 3 with CardedAwardListElement

use of com.thebluealliance.androidclient.listitems.CardedAwardListElement 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)

Example 4 with CardedAwardListElement

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

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

the class AwardRendererTest method testRenderTeamCarded.

@Test
public void testRenderTeamCarded() {
    Award award = ModelMaker.getModel(Award.class, AWARD_TEAM);
    ListItem rendered = mRenderer.renderFromModel(award, new AwardRenderer.RenderArgs(new HashMap<>(), null));
    assertNotNull(rendered);
    assertTrue(rendered instanceof CardedAwardListElement);
}
Also used : CardedAwardListElement(com.thebluealliance.androidclient.listitems.CardedAwardListElement) HashMap(java.util.HashMap) Award(com.thebluealliance.androidclient.models.Award) ListItem(com.thebluealliance.androidclient.listitems.ListItem) Test(org.junit.Test)

Aggregations

CardedAwardListElement (com.thebluealliance.androidclient.listitems.CardedAwardListElement)5 ListItem (com.thebluealliance.androidclient.listitems.ListItem)5 Test (org.junit.Test)4 Award (com.thebluealliance.androidclient.models.Award)3 HashMap (java.util.HashMap)2 EventAwardsEvent (com.thebluealliance.androidclient.eventbus.EventAwardsEvent)1 EventBus (org.greenrobot.eventbus.EventBus)1