Search in sources :

Example 6 with DiscussionTopic

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

the class DiscussionManager method getFullDiscussionTopic.

public static void getFullDiscussionTopic(CanvasContext canvasContext, long topicId, boolean forceNetwork, StatusCallback<DiscussionTopic> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).build();
        DiscussionAPI.getFullDiscussionTopic(adapter, canvasContext, topicId, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 7 with DiscussionTopic

use of com.instructure.canvasapi2.models.DiscussionTopic 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 8 with DiscussionTopic

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

the class DiscussionTopicTest method getParticipantsMap_Size.

@Test
public void getParticipantsMap_Size() throws Exception {
    DiscussionTopic topic = new DiscussionTopic();
    ArrayList<DiscussionParticipant> participants = new ArrayList<>();
    DiscussionParticipant participant = new DiscussionParticipant();
    participant.setId(64343L);
    participants.add(participant);
    topic.setParticipants(participants);
    assertEquals(1, topic.getParticipantsMap().size());
}
Also used : ArrayList(java.util.ArrayList) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) DiscussionParticipant(com.instructure.canvasapi2.models.DiscussionParticipant) Test(org.junit.Test)

Example 9 with DiscussionTopic

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

the class DiscussionTopicTest method getParticipantsMap_Content.

@Test
public void getParticipantsMap_Content() throws Exception {
    long id = 534234L;
    DiscussionTopic topic = new DiscussionTopic();
    ArrayList<DiscussionParticipant> participants = new ArrayList<>();
    DiscussionParticipant participant = new DiscussionParticipant();
    participant.setId(id);
    participants.add(participant);
    topic.setParticipants(participants);
    assertEquals(id, topic.getParticipantsMap().keySet().toArray()[0]);
}
Also used : ArrayList(java.util.ArrayList) DiscussionTopic(com.instructure.canvasapi2.models.DiscussionTopic) DiscussionParticipant(com.instructure.canvasapi2.models.DiscussionParticipant) Test(org.junit.Test)

Aggregations

DiscussionTopic (com.instructure.canvasapi2.models.DiscussionTopic)8 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)5 DiscussionEntry (com.instructure.canvasapi2.models.DiscussionEntry)4 DiscussionParticipant (com.instructure.canvasapi2.models.DiscussionParticipant)2 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)1 RestParams (com.instructure.canvasapi2.builders.RestParams)1