Search in sources :

Example 1 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry 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());
}
Also used : ArrayList(java.util.ArrayList) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) Test(org.junit.Test)

Example 2 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry in project instructure-android by instructure.

the class DiscussionEntryTest method addReplyTest.

@Test
public void addReplyTest() throws Exception {
    DiscussionEntry entry = new DiscussionEntry();
    entry.addReply(null);
    assertNotNull(entry.getReplies());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 3 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry 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());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) Test(org.junit.Test)

Example 4 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry in project instructure-android by instructure.

the class DiscussionEntryTest method depthTest_One.

@Test
public void depthTest_One() throws Exception {
    DiscussionEntry entry = new DiscussionEntry();
    DiscussionEntry parent = new DiscussionEntry();
    entry.setParent(parent);
    assertEquals(1, entry.getDepth());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 5 with DiscussionEntry

use of com.instructure.canvasapi2.models.DiscussionEntry 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());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) Test(org.junit.Test)

Aggregations

DiscussionEntry (com.instructure.canvasapi2.models.DiscussionEntry)14 Test (org.junit.Test)14 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)6 RestParams (com.instructure.canvasapi2.builders.RestParams)6 DiscussionTopic (com.instructure.canvasapi2.models.DiscussionTopic)4 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)4 DiscussionEntryHtmlConverter (com.instructure.pandautils.discussions.DiscussionEntryHtmlConverter)2 Assignment (com.instructure.canvasapi2.models.Assignment)1 RemoteFile (com.instructure.canvasapi2.models.RemoteFile)1 ArrayList (java.util.ArrayList)1