Search in sources :

Example 16 with DiscussionEntry

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

the class DiscussionEntryHTMLConverterTest method getReadState_read.

@Test
public void getReadState_read() throws Exception {
    DiscussionEntryHtmlConverter converter = new DiscussionEntryHtmlConverter();
    DiscussionEntry discussionEntry = new DiscussionEntry();
    discussionEntry.setUnread(false);
    String testValue = converter.getReadState(discussionEntry);
    assertEquals("read", testValue);
}
Also used : DiscussionEntryHtmlConverter(com.instructure.pandautils.discussions.DiscussionEntryHtmlConverter) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 17 with DiscussionEntry

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

the class DiscussionEntryTest method addInnerReplyTest.

@Test
public void addInnerReplyTest() throws Exception {
    DiscussionEntry entry = new DiscussionEntry();
    entry.setId(1L);
    DiscussionEntry reply = new DiscussionEntry();
    entry.addReply(reply);
    DiscussionEntry innerReply = new DiscussionEntry();
    entry.addInnerReply(reply, innerReply);
    assertEquals(1, entry.getReplies().get(0).getReplies().size());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 18 with DiscussionEntry

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

the class DiscussionEntryTest method depthTest_Zero.

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

Example 19 with DiscussionEntry

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

the class DiscussionEntryTest method initTest_Unread.

@Test
public void initTest_Unread() throws Exception {
    DiscussionTopic topic = new DiscussionTopic();
    DiscussionEntry parent = new DiscussionEntry();
    DiscussionEntry entry = new DiscussionEntry();
    entry.init(topic, parent);
    assertEquals(0, entry.getUnreadChildren());
}
Also used : DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) Test(org.junit.Test)

Example 20 with DiscussionEntry

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

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_Message.

@Test
public void convertToDiscussionEntryTest_Message() throws Exception {
    String message = "here is a message";
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    header.setMessage(message);
    DiscussionEntry entry = header.convertToDiscussionEntry("graded", "points");
    assertEquals(header.getMessage(), entry.getMessage());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) 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