Search in sources :

Example 1 with Recipient

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

the class ChooseMessageRecipientRecyclerAdapterTest method testAreContentsTheSame_SameName.

@Test
public void testAreContentsTheSame_SameName() {
    Recipient recipient = new Recipient("", "name", 0, 0, 0);
    assertTrue(mAdapter.getItemCallback().areContentsTheSame(recipient, recipient));
}
Also used : Recipient(com.instructure.canvasapi2.models.Recipient) Test(org.junit.Test)

Example 2 with Recipient

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

the class RecipientManager_Test method getFirstPageRecipients.

public static void getFirstPageRecipients(String searchQuery, String context, StatusCallback<List<Recipient>> callback, RestBuilder adapter, RestParams params) {
    // TODO:
    Response response = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    List<Recipient> items = new ArrayList<>();
    retrofit2.Response<List<Recipient>> response1 = retrofit2.Response.success(items, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ArrayList(java.util.ArrayList) Recipient(com.instructure.canvasapi2.models.Recipient) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with Recipient

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

the class RecipientTest method getIdAsLongTest_Null.

@Test
public void getIdAsLongTest_Null() throws Exception {
    Recipient recipient = new Recipient();
    recipient.setStringId("invalid_id");
    assertEquals(0, recipient.getIdAsLong());
}
Also used : Recipient(com.instructure.canvasapi2.models.Recipient) Test(org.junit.Test)

Example 4 with Recipient

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

the class RecipientTest method getIdAsLongTest_Course.

@Test
public void getIdAsLongTest_Course() throws Exception {
    Recipient recipient = new Recipient();
    recipient.setStringId("course_456789");
    assertEquals(456789, recipient.getIdAsLong());
}
Also used : Recipient(com.instructure.canvasapi2.models.Recipient) Test(org.junit.Test)

Example 5 with Recipient

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

the class RecipientTest method getRecipientTypeTest_Group.

@Test
public void getRecipientTypeTest_Group() throws Exception {
    Recipient recipient = new Recipient();
    recipient.setStringId("not_a_person");
    recipient.setUserCount(2);
    assertEquals(Recipient.Type.group, recipient.getRecipientType());
}
Also used : Recipient(com.instructure.canvasapi2.models.Recipient) Test(org.junit.Test)

Aggregations

Recipient (com.instructure.canvasapi2.models.Recipient)14 Test (org.junit.Test)9 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)7 RestParams (com.instructure.canvasapi2.builders.RestParams)4 NonNull (android.support.annotation.NonNull)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 RecipientEntry (com.android.ex.chips.RecipientEntry)2 StatusCallback (com.instructure.canvasapi2.StatusCallback)2 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)2 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 Rfc822Tokenizer (android.text.util.Rfc822Tokenizer)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1 Enrollment (com.instructure.canvasapi2.models.Enrollment)1 User (com.instructure.canvasapi2.models.User)1 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)1 RecipientAdapter (com.instructure.teacher.adapters.RecipientAdapter)1