use of com.instructure.canvasapi2.models.DiscussionTopic in project instructure-android by instructure.
the class DiscussionEntryTest method initTest_UnreadChildrenOne.
@Test
public void initTest_UnreadChildrenOne() throws Exception {
long id = 7L;
ArrayList<Long> unreadEntries = new ArrayList<>();
DiscussionTopic topic = new DiscussionTopic();
DiscussionEntry parent = new DiscussionEntry();
DiscussionEntry entry = new DiscussionEntry();
DiscussionEntry reply = new DiscussionEntry();
reply.setId(id);
unreadEntries.add(id);
topic.setUnreadEntries(unreadEntries);
entry.addReply(reply);
entry.init(topic, parent);
assertEquals(1, entry.getUnreadChildren());
}
use of com.instructure.canvasapi2.models.DiscussionTopic in project instructure-android by instructure.
the class DiscussionEntryTest method initTest_TotalChildrenZero.
@Test
public void initTest_TotalChildrenZero() throws Exception {
DiscussionTopic topic = new DiscussionTopic();
DiscussionEntry parent = new DiscussionEntry();
DiscussionEntry entry = new DiscussionEntry();
entry.init(topic, parent);
assertEquals(0, entry.getTotalChildren());
}
use of com.instructure.canvasapi2.models.DiscussionTopic in project instructure-android by instructure.
the class DiscussionEntryTest method initTest_TotalChildrenOne.
@Test
public void initTest_TotalChildrenOne() throws Exception {
DiscussionTopic topic = new DiscussionTopic();
DiscussionEntry parent = new DiscussionEntry();
DiscussionEntry entry = new DiscussionEntry();
DiscussionEntry reply = new DiscussionEntry();
entry.addReply(reply);
entry.init(topic, parent);
assertEquals(1, entry.getTotalChildren());
}
use of com.instructure.canvasapi2.models.DiscussionTopic in project instructure-android by instructure.
the class DiscussionTopicTest method getUnreadEntriesMap_Content.
@Test
public void getUnreadEntriesMap_Content() throws Exception {
long id = 8L;
DiscussionTopic topic = new DiscussionTopic();
ArrayList<Long> unreadList = new ArrayList<>();
unreadList.add(id);
topic.setUnreadEntries(unreadList);
assertEquals(id, topic.getUnreadEntriesMap().keySet().toArray()[0]);
}
use of com.instructure.canvasapi2.models.DiscussionTopic in project instructure-android by instructure.
the class DiscussionTopicTest method getUnreadEntriesMap_Size.
@Test
public void getUnreadEntriesMap_Size() throws Exception {
DiscussionTopic topic = new DiscussionTopic();
ArrayList<Long> unreadList = new ArrayList<>();
unreadList.add(8L);
unreadList.add(13435L);
topic.setUnreadEntries(unreadList);
assertEquals(2, topic.getUnreadEntriesMap().size());
}
Aggregations