Search in sources :

Example 6 with Conversation

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

the class ConversationTest method isMonologue_noAudience.

@Test
public void isMonologue_noAudience() {
    Conversation conversation = new Conversation();
    conversation.setAudience(null);
    assertEquals(false, conversation.isMonologue(0L));
}
Also used : Conversation(com.instructure.canvasapi2.models.Conversation) Test(org.junit.Test)

Example 7 with Conversation

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

the class ConversationTest method getLastMessageSent.

@Test
public void getLastMessageSent() {
    Conversation conversation = new Conversation();
    conversation.setLastMessageAt("2008-09-15T15:53:00+05:00");
    Date expectedDate = new Date(1221475980000L);
    assertEquals(0, expectedDate.compareTo(conversation.getLastMessageSent()));
}
Also used : Conversation(com.instructure.canvasapi2.models.Conversation) Date(java.util.Date) Test(org.junit.Test)

Example 8 with Conversation

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

the class ConversationTest method getLastMessagePreview_deleted.

@Test
public void getLastMessagePreview_deleted() {
    Conversation conversation = new Conversation();
    conversation.setDeletedString("conversation deleted");
    conversation.setLastMessage("last message");
    conversation.setDeleted(true);
    assertEquals("conversation deleted", conversation.getLastMessagePreview());
}
Also used : Conversation(com.instructure.canvasapi2.models.Conversation) Test(org.junit.Test)

Example 9 with Conversation

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

the class ConversationTest method isMonologue_userInAudience.

@Test
public void isMonologue_userInAudience() {
    Conversation conversation = new Conversation();
    ArrayList<Long> audience = new ArrayList<>();
    audience.add(1L);
    audience.add(2L);
    audience.add(3L);
    conversation.setAudience(audience);
    assertEquals(true, conversation.isMonologue(1L));
}
Also used : ArrayList(java.util.ArrayList) Conversation(com.instructure.canvasapi2.models.Conversation) Test(org.junit.Test)

Example 10 with Conversation

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

the class ConversationTest method isMonologue_userNotInAudience.

@Test
public void isMonologue_userNotInAudience() {
    Conversation conversation = new Conversation();
    ArrayList<Long> audience = new ArrayList<>();
    audience.add(1L);
    audience.add(2L);
    audience.add(3L);
    conversation.setAudience(audience);
    assertEquals(false, conversation.isMonologue(4L));
}
Also used : ArrayList(java.util.ArrayList) Conversation(com.instructure.canvasapi2.models.Conversation) Test(org.junit.Test)

Aggregations

Conversation (com.instructure.canvasapi2.models.Conversation)28 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)20 Test (org.junit.Test)14 RestParams (com.instructure.canvasapi2.builders.RestParams)12 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)9 Response (okhttp3.Response)8 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)3 List (java.util.List)3 Nullable (android.support.annotation.Nullable)2 Date (java.util.Date)2 Bundle (android.os.Bundle)1 Rfc822Tokenizer (android.text.util.Rfc822Tokenizer)1 Menu (android.view.Menu)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1