use of com.thebluealliance.androidclient.listitems.ContributorListElement in project the-blue-alliance-android by the-blue-alliance.
the class ContributorListSubscriber method parseData.
@Override
public void parseData() {
mDataToBind.clear();
JsonArray data = mAPIData.getAsJsonArray();
for (JsonElement e : data) {
JsonObject user = e.getAsJsonObject();
String username = user.get("login").getAsString();
int contributionCount = user.get("contributions").getAsInt();
String avatarUrl = user.get("avatar_url").getAsString();
mDataToBind.add(new ContributorListElement(username, contributionCount, avatarUrl));
}
}
use of com.thebluealliance.androidclient.listitems.ContributorListElement 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);
}
Aggregations