Search in sources :

Example 26 with Enrollment

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

the class EnrollmentTest method isStudent_StudentEnrollment.

@Test
public void isStudent_StudentEnrollment() {
    Enrollment enrollment = new Enrollment();
    enrollment.setType("studentenrollment");
    assertEquals(true, enrollment.isStudent());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Example 27 with Enrollment

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

the class EnrollmentTest method getFinalGrade_NullGrades.

@Test
public void getFinalGrade_NullGrades() {
    Enrollment enrollment = new Enrollment();
    enrollment.setComputedFinalGrade("C-");
    enrollment.setGrades(null);
    assertEquals("C-", enrollment.getFinalGrade());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Example 28 with Enrollment

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

the class EnrollmentTest method isObserver_Observer.

@Test
public void isObserver_Observer() {
    Enrollment enrollment = new Enrollment();
    enrollment.setType("observer");
    assertEquals(true, enrollment.isObserver());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Example 29 with Enrollment

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

the class EnrollmentTest method getFinalGrade.

@Test
public void getFinalGrade() {
    Grades grades = new Grades();
    grades.setFinalGrade("B+");
    Enrollment enrollment = new Enrollment();
    enrollment.setComputedFinalGrade("C-");
    enrollment.setGrades(grades);
    assertEquals("B+", enrollment.getFinalGrade());
}
Also used : Grades(com.instructure.canvasapi2.models.Grades) Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Example 30 with Enrollment

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

the class EnrollmentManager method getSelfEnrollments.

public static void getSelfEnrollments(@Nullable final List<String> types, @Nullable final List<String> states, boolean forceNetwork, @NonNull StatusCallback<List<Enrollment>> callback) {
    if (isTesting() || mTesting) {
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
        StatusCallback<List<Enrollment>> depaginatedCallback = new ExhaustiveListCallback<Enrollment>(callback) {

            @Override
            public void getNextPage(@NonNull StatusCallback<List<Enrollment>> callback, @NonNull String nextUrl, boolean isCached) {
                EnrollmentAPI.getSelfEnrollments(types, states, adapter, params, callback);
            }
        };
        adapter.setStatusCallback(depaginatedCallback);
        EnrollmentAPI.getSelfEnrollments(types, states, adapter, params, callback);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) NonNull(android.support.annotation.NonNull) Enrollment(com.instructure.canvasapi2.models.Enrollment) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) List(java.util.List) StatusCallback(com.instructure.canvasapi2.StatusCallback) ExhaustiveListCallback(com.instructure.canvasapi2.utils.ExhaustiveListCallback)

Aggregations

Enrollment (com.instructure.canvasapi2.models.Enrollment)55 Test (org.junit.Test)46 Course (com.instructure.canvasapi2.models.Course)30 ArrayList (java.util.ArrayList)25 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)7 RestParams (com.instructure.canvasapi2.builders.RestParams)7 NonNull (android.support.annotation.NonNull)4 Grades (com.instructure.canvasapi2.models.Grades)4 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)3 List (java.util.List)3 GradingPeriod (com.instructure.canvasapi2.models.GradingPeriod)2 User (com.instructure.canvasapi2.models.User)2 Application (android.app.Application)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 View (android.view.View)1 BasicUser (com.instructure.canvasapi2.models.BasicUser)1 ErrorReportResult (com.instructure.canvasapi2.models.ErrorReportResult)1 ApiType (com.instructure.canvasapi2.utils.ApiType)1