Search in sources :

Example 6 with ToDo

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

the class TodoListRecyclerAdapterTest method testAreContentsTheSame_SameTitleFromSchedule.

@Test
public void testAreContentsTheSame_SameTitleFromSchedule() {
    ToDo item = new ToDo();
    ScheduleItem scheduleItem = new ScheduleItem();
    scheduleItem.setTitle("item");
    item.setScheduleItem(scheduleItem);
    assertTrue(mAdapter.createItemCallback().areContentsTheSame(item, item));
}
Also used : ToDo(com.instructure.canvasapi2.models.ToDo) ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Test(org.junit.Test)

Example 7 with ToDo

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

the class TodoListRecyclerAdapterTest method testAreContentsTheSame_DifferentTitleFromAssignment.

@Test
public void testAreContentsTheSame_DifferentTitleFromAssignment() {
    ToDo item = new ToDo();
    Assignment assignment = new Assignment();
    assignment.setName("item");
    item.setAssignment(assignment);
    ToDo item1 = new ToDo();
    Assignment assignment1 = new Assignment();
    assignment1.setName("item1");
    item1.setAssignment(assignment1);
    assertFalse(mAdapter.createItemCallback().areContentsTheSame(item, item1));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ToDo(com.instructure.canvasapi2.models.ToDo) Test(org.junit.Test)

Example 8 with ToDo

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

the class QuizManager_Test method getQuizQuestions.

public static void getQuizQuestions(long courseId, long quizId, StatusCallback<List<QuizQuestion>> callback) {
    // 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<QuizQuestion> quizQuestions = new ArrayList<>();
    retrofit2.Response<List<QuizQuestion>> response1 = retrofit2.Response.success(quizQuestions, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) QuizQuestion(com.instructure.canvasapi2.models.QuizQuestion) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 9 with ToDo

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

the class QuizManager_Test method getQuizesQuestions.

public static void getQuizesQuestions(StatusCallback<List<Quiz>> callback) {
    // 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<Quiz> quizzes = new ArrayList<>();
    Quiz quiz = new Quiz();
    quiz.setTitle("TEST");
    quiz.setDescription("description");
    quizzes.add(quiz);
    retrofit2.Response<List<Quiz>> response1 = retrofit2.Response.success(quizzes, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) Quiz(com.instructure.canvasapi2.models.Quiz) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 10 with ToDo

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

the class QuizManager_Test method getQuizSubmissionQuestions.

public static void getQuizSubmissionQuestions(long quizSubmissionId, StatusCallback<QuizSubmissionQuestionResponse> callback) {
    // 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();
    QuizSubmissionQuestionResponse quizSubmissionQuestionResponse = new QuizSubmissionQuestionResponse();
    List<QuizSubmissionQuestion> quizQuestions = new ArrayList<>();
    QuizSubmissionQuestion question = new QuizSubmissionQuestion();
    question.setQuestionText("TEST");
    question.setQuestionType("essay_question");
    quizQuestions.add(question);
    quizSubmissionQuestionResponse.setQuizSubmissionQuestions(quizQuestions);
    retrofit2.Response<QuizSubmissionQuestionResponse> response1 = retrofit2.Response.success(quizSubmissionQuestionResponse, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) ArrayList(java.util.ArrayList) QuizSubmissionQuestion(com.instructure.canvasapi2.models.QuizSubmissionQuestion)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)158 RestParams (com.instructure.canvasapi2.builders.RestParams)141 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)51 Response (okhttp3.Response)47 List (java.util.List)43 ArrayList (java.util.ArrayList)36 Request (okhttp3.Request)26 StatusCallback (com.instructure.canvasapi2.StatusCallback)21 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)20 NonNull (android.support.annotation.NonNull)19 Conversation (com.instructure.canvasapi2.models.Conversation)10 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)8 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)8 ToDo (com.instructure.canvasapi2.models.ToDo)8 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)7 Assignment (com.instructure.canvasapi2.models.Assignment)6 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)6 FileFolder (com.instructure.canvasapi2.models.FileFolder)6 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)6 Course (com.instructure.canvasapi2.models.Course)5