diff --git a/classroom/snippets/src/main/java/CreateCourseWork.java b/classroom/snippets/src/main/java/CreateCourseWork.java index 631ced38..7f9973ca 100644 --- a/classroom/snippets/src/main/java/CreateCourseWork.java +++ b/classroom/snippets/src/main/java/CreateCourseWork.java @@ -80,13 +80,14 @@ public static CourseWork createCourseWork(String courseId) throws IOException { .setDescription("Read about how the SR-71 Blackbird, the world’s fastest and " + "highest-flying manned aircraft, was built.") .setMaterials(materials) - .setDueDate(new Date().setMonth(12).setDay(10).setYear(2022)) - .setDueTime(new TimeOfDay().setHours(15).setMinutes(0)) .setWorkType("ASSIGNMENT") .setState("PUBLISHED"); courseWork = service.courses().courseWork().create(courseId, content) .execute(); + + /* Prints the created courseWork. */ + System.out.printf("CourseWork created: %s\n", courseWork.getTitle()); } catch (GoogleJsonResponseException e) { //TODO (developer) - handle error appropriately GoogleJsonError error = e.getDetails(); diff --git a/classroom/snippets/src/main/java/GetTopic.java b/classroom/snippets/src/main/java/GetTopic.java index 5332bd5c..140a0407 100644 --- a/classroom/snippets/src/main/java/GetTopic.java +++ b/classroom/snippets/src/main/java/GetTopic.java @@ -60,6 +60,7 @@ public static Topic getTopic(String courseId, String topicId) throws IOException try { // Get the topic. topic = service.courses().topics().get(courseId, topicId).execute(); + System.out.printf("Topic '%s' found.\n", topic.getName()); } catch (GoogleJsonResponseException e) { //TODO (developer) - handle error appropriately GoogleJsonError error = e.getDetails(); diff --git a/classroom/snippets/src/main/java/ListCourseAliases.java b/classroom/snippets/src/main/java/ListCourseAliases.java index 171f4fa6..c3141cf1 100644 --- a/classroom/snippets/src/main/java/ListCourseAliases.java +++ b/classroom/snippets/src/main/java/ListCourseAliases.java @@ -13,7 +13,7 @@ // limitations under the License. -// [START classroom_list_aliases] +// [START classroom_list_aliases_class] import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonResponseException; @@ -57,6 +57,8 @@ public static List listCourseAliases(String courseId) .setApplicationName("Classroom samples") .build(); + // [START classroom_list_aliases_code_snippet] + String pageToken = null; List courseAliases = new ArrayList<>(); @@ -89,6 +91,8 @@ public static List listCourseAliases(String courseId) } } return courseAliases; + + // [END classroom_list_aliases_code_snippet] } } -// [END classroom_list_aliases] \ No newline at end of file +// [END classroom_list_aliases_class] \ No newline at end of file diff --git a/classroom/snippets/src/main/java/ListStudentSubmissions.java b/classroom/snippets/src/main/java/ListStudentSubmissions.java new file mode 100644 index 00000000..acc7b898 --- /dev/null +++ b/classroom/snippets/src/main/java/ListStudentSubmissions.java @@ -0,0 +1,105 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// [START classroom_list_student_submissions_class] + +import com.google.api.client.googleapis.json.GoogleJsonError; +import com.google.api.client.googleapis.json.GoogleJsonResponseException; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.classroom.Classroom; +import com.google.api.services.classroom.ClassroomScopes; +import com.google.api.services.classroom.model.ListStudentSubmissionsResponse; +import com.google.api.services.classroom.model.StudentSubmission; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/* Class to demonstrate the use of Classroom List StudentSubmissions API. */ +public class ListStudentSubmissions { + /** + * Retrieves a specific student's submissions for the specified course work. + * + * @param courseId - identifier of the course. + * @param courseWorkId - identifier of the course work. + * @param userId - identifier of the student whose work to return. + * @return - list of student submissions. + * @throws IOException - if credentials file not found. + */ + public static List listStudentSubmissions(String courseId, String courseWorkId, + String userId) throws IOException { + /* Load pre-authorized user credentials from the environment. + TODO(developer) - See https://developers.google.com/identity for + guides on implementing OAuth2 for your application. */ + GoogleCredentials credentials = GoogleCredentials.getApplicationDefault() + .createScoped(Collections.singleton(ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS)); + HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter( + credentials); + + // Create the classroom API client. + Classroom service = new Classroom.Builder(new NetHttpTransport(), + GsonFactory.getDefaultInstance(), + requestInitializer) + .setApplicationName("Classroom samples") + .build(); + + // [START classroom_list_student_submissions_code_snippet] + + List studentSubmissions = new ArrayList<>(); + String pageToken = null; + + try { + do { + // Set the userId as a query parameter on the request. + ListStudentSubmissionsResponse response = service.courses().courseWork().studentSubmissions() + .list(courseId, courseWorkId) + .set("userId", userId) + .execute(); + if (response.getStudentSubmissions() != null) { + studentSubmissions.addAll(response.getStudentSubmissions()); + pageToken = response.getNextPageToken(); + } + } while (pageToken != null); + + if (studentSubmissions.isEmpty()) { + System.out.println("No student submission found."); + } else { + for (StudentSubmission submission : studentSubmissions) { + System.out.printf("Student submission: %s.\n", submission.getId()); + } + } + } catch (GoogleJsonResponseException e) { + //TODO (developer) - handle error appropriately + GoogleJsonError error = e.getDetails(); + if (error.getCode() == 404) { + System.out.printf("The courseId (%s), courseWorkId (%s), or userId (%s) does " + + "not exist.\n", courseId, courseWorkId, userId); + } else { + throw e; + } + } catch (Exception e) { + throw e; + } + return studentSubmissions; + + // [END classroom_list_student_submissions_code_snippet] + + } +} +// [END classroom_list_student_submissions_class] \ No newline at end of file diff --git a/classroom/snippets/src/main/java/ListSubmissions.java b/classroom/snippets/src/main/java/ListSubmissions.java new file mode 100644 index 00000000..ed5898de --- /dev/null +++ b/classroom/snippets/src/main/java/ListSubmissions.java @@ -0,0 +1,102 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// [START classroom_list_submissions_class] + +import com.google.api.client.googleapis.json.GoogleJsonError; +import com.google.api.client.googleapis.json.GoogleJsonResponseException; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.classroom.Classroom; +import com.google.api.services.classroom.ClassroomScopes; +import com.google.api.services.classroom.model.ListStudentSubmissionsResponse; +import com.google.api.services.classroom.model.StudentSubmission; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/* Class to demonstrate the use of Classroom List StudentSubmissions API. */ +public class ListSubmissions { + /** + * Retrieves submissions for all students for the specified course work in a course. + * + * @param courseId - identifier of the course. + * @param courseWorkId - identifier of the course work. + * @return - list of student submissions. + * @throws IOException - if credentials file not found. + */ + public static List listSubmissions(String courseId, String courseWorkId) + throws IOException { + /* Load pre-authorized user credentials from the environment. + TODO(developer) - See https://developers.google.com/identity for + guides on implementing OAuth2 for your application. */ + GoogleCredentials credentials = GoogleCredentials.getApplicationDefault() + .createScoped(Collections.singleton(ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS)); + HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter( + credentials); + + // Create the classroom API client. + Classroom service = new Classroom.Builder(new NetHttpTransport(), + GsonFactory.getDefaultInstance(), + requestInitializer) + .setApplicationName("Classroom samples") + .build(); + + // [START classroom_list_submissions_code_snippet] + + List studentSubmissions = new ArrayList<>(); + String pageToken = null; + + try { + do { + ListStudentSubmissionsResponse response = service.courses().courseWork().studentSubmissions() + .list(courseId, courseWorkId) + .execute(); + if (response.getStudentSubmissions() != null) { + studentSubmissions.addAll(response.getStudentSubmissions()); + } + } while (pageToken != null); + + if (studentSubmissions.isEmpty()) { + System.out.println("No student submission found."); + } else { + for (StudentSubmission submission : studentSubmissions) { + System.out.printf("Student id (%s), student submission id (%s)\n", submission.getUserId(), + submission.getId()); + } + } + } catch (GoogleJsonResponseException e) { + //TODO (developer) - handle error appropriately + GoogleJsonError error = e.getDetails(); + if (error.getCode() == 404) { + System.out.printf("The courseId (%s) or courseWorkId (%s) does not exist.\n", courseId, + courseWorkId); + } else { + throw e; + } + } catch (Exception e) { + throw e; + } + return studentSubmissions; + + // [END classroom_list_submissions_code_snippet] + + } +} +// [END classroom_list_submissions_class] \ No newline at end of file diff --git a/classroom/snippets/src/main/java/ListTopics.java b/classroom/snippets/src/main/java/ListTopics.java index 61ea9b89..e754f82b 100644 --- a/classroom/snippets/src/main/java/ListTopics.java +++ b/classroom/snippets/src/main/java/ListTopics.java @@ -67,8 +67,10 @@ public static List listTopics(String courseId) throws IOException { .setPageSize(100) .setPageToken(pageToken) .execute(); - topics.addAll(response.getTopic()); - pageToken = response.getNextPageToken(); + if (response.getTopic() != null) { + topics.addAll(response.getTopic()); + pageToken = response.getNextPageToken(); + } } while (pageToken != null); if (topics.isEmpty()) { diff --git a/classroom/snippets/src/main/java/ModifyAttachmentsStudentSubmission.java b/classroom/snippets/src/main/java/ModifyAttachmentsStudentSubmission.java new file mode 100644 index 00000000..252f51f5 --- /dev/null +++ b/classroom/snippets/src/main/java/ModifyAttachmentsStudentSubmission.java @@ -0,0 +1,100 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// [START classroom_modify_attachments_student_submissions_class] + +import com.google.api.client.googleapis.json.GoogleJsonError; +import com.google.api.client.googleapis.json.GoogleJsonResponseException; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.classroom.Classroom; +import com.google.api.services.classroom.ClassroomScopes; +import com.google.api.services.classroom.model.Attachment; +import com.google.api.services.classroom.model.Link; +import com.google.api.services.classroom.model.ModifyAttachmentsRequest; +import com.google.api.services.classroom.model.StudentSubmission; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +/* Class to demonstrate the use of Classroom ModifyAttachments StudentSubmissions API. */ +public class ModifyAttachmentsStudentSubmission { + /** + * Modify attachments on a student submission. + * + * @param courseId - identifier of the course. + * @param courseWorkId - identifier of the course work. + * @param id - identifier of the student submission. + * @return - the modified student submission. + * @throws IOException - if credentials file not found. + */ + public static StudentSubmission modifyAttachments(String courseId, String courseWorkId, String id) + throws IOException { + /* Load pre-authorized user credentials from the environment. + TODO(developer) - See https://developers.google.com/identity for + guides on implementing OAuth2 for your application. */ + GoogleCredentials credentials = GoogleCredentials.getApplicationDefault() + .createScoped(Collections.singleton(ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS)); + HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter( + credentials); + + // Create the classroom API client. + Classroom service = new Classroom.Builder(new NetHttpTransport(), + GsonFactory.getDefaultInstance(), + requestInitializer) + .setApplicationName("Classroom samples") + .build(); + + // [START classroom_modify_attachments_student_submissions_code_snippet] + + StudentSubmission studentSubmission = null; + try { + // Create ModifyAttachmentRequest object that includes a new attachment with a link. + Link link = new Link().setUrl("https://en.wikipedia.org/wiki/Irrational_number"); + Attachment attachment = new Attachment().setLink(link); + ModifyAttachmentsRequest modifyAttachmentsRequest = new ModifyAttachmentsRequest() + .setAddAttachments(Arrays.asList(attachment)); + + // The modified studentSubmission object is returned with the new attachment added to it. + studentSubmission = service.courses().courseWork().studentSubmissions().modifyAttachments( + courseId, courseWorkId, id, modifyAttachmentsRequest) + .execute(); + + /* Prints the modified student submission. */ + System.out.printf("Modified student submission attachments: '%s'.\n", studentSubmission + .getAssignmentSubmission() + .getAttachments()); + } catch (GoogleJsonResponseException e) { + //TODO (developer) - handle error appropriately + GoogleJsonError error = e.getDetails(); + if (error.getCode() == 404) { + System.out.printf("The courseId (%s), courseWorkId (%s), or studentSubmissionId (%s) does " + + "not exist.\n", courseId, courseWorkId, id); + } else { + throw e; + } + } catch(Exception e) { + throw e; + } + return studentSubmission; + + // [END classroom_modify_attachments_student_submissions_code_snippet] + + } +} +// [END classroom_modify_attachments_student_submissions_class] \ No newline at end of file diff --git a/classroom/snippets/src/main/java/PatchStudentSubmission.java b/classroom/snippets/src/main/java/PatchStudentSubmission.java new file mode 100644 index 00000000..1690ef8e --- /dev/null +++ b/classroom/snippets/src/main/java/PatchStudentSubmission.java @@ -0,0 +1,98 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// [START classroom_patch_student_submissions_class] + +import com.google.api.client.googleapis.json.GoogleJsonError; +import com.google.api.client.googleapis.json.GoogleJsonResponseException; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.classroom.Classroom; +import com.google.api.services.classroom.ClassroomScopes; +import com.google.api.services.classroom.model.StudentSubmission; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.io.IOException; +import java.util.Collections; + +/* Class to demonstrate the use of Classroom Patch StudentSubmissions API. */ +public class PatchStudentSubmission { + /** + * Updates the draft grade and/or assigned grade of a student submission. + * + * @param courseId - identifier of the course. + * @param courseWorkId - identifier of the course work. + * @param id - identifier of the student submission. + * @return - the updated student submission. + * @throws IOException - if credentials file not found. + */ + public static StudentSubmission patchStudentSubmission(String courseId, String courseWorkId, + String id) throws IOException { + /* Load pre-authorized user credentials from the environment. + TODO(developer) - See https://developers.google.com/identity for + guides on implementing OAuth2 for your application. */ + GoogleCredentials credentials = GoogleCredentials.getApplicationDefault() + .createScoped(Collections.singleton(ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS)); + HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter( + credentials); + + // Create the classroom API client. + Classroom service = new Classroom.Builder(new NetHttpTransport(), + GsonFactory.getDefaultInstance(), + requestInitializer) + .setApplicationName("Classroom samples") + .build(); + + // [START classroom_patch_student_submissions_code_snippet] + + StudentSubmission studentSubmission = null; + try { + // Updating the draftGrade and assignedGrade fields for the specific student submission. + StudentSubmission content = service.courses().courseWork().studentSubmissions() + .get(courseId, courseWorkId, id) + .execute(); + content.setAssignedGrade(90.00); + content.setDraftGrade(80.00); + + // The updated studentSubmission object is returned with the new draftGrade and assignedGrade. + studentSubmission = service.courses().courseWork().studentSubmissions() + .patch(courseId, courseWorkId, id, content) + .set("updateMask", "draftGrade,assignedGrade") + .execute(); + + /* Prints the updated student submission. */ + System.out.printf("Updated student submission draft grade (%s) and assigned grade (%s).\n", + studentSubmission.getDraftGrade(), + studentSubmission.getAssignedGrade()); + } catch (GoogleJsonResponseException e) { + //TODO (developer) - handle error appropriately + GoogleJsonError error = e.getDetails(); + if (error.getCode() == 404) { + System.out.printf("The courseId (%s), courseWorkId (%s), or studentSubmissionId (%s) does " + + "not exist.\n", courseId, courseWorkId, id); + } else { + throw e; + } + } catch (Exception e) { + throw e; + } + return studentSubmission; + + // [END classroom_patch_student_submissions_code_snippet] + + } +} +// [END classroom_patch_student_submissions_class] \ No newline at end of file diff --git a/classroom/snippets/src/main/java/ReturnStudentSubmission.java b/classroom/snippets/src/main/java/ReturnStudentSubmission.java new file mode 100644 index 00000000..6b40fc96 --- /dev/null +++ b/classroom/snippets/src/main/java/ReturnStudentSubmission.java @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// [START classroom_return_student_submissions_class] + +import com.google.api.client.googleapis.json.GoogleJsonError; +import com.google.api.client.googleapis.json.GoogleJsonResponseException; +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import com.google.api.services.classroom.Classroom; +import com.google.api.services.classroom.ClassroomScopes; +import com.google.auth.http.HttpCredentialsAdapter; +import com.google.auth.oauth2.GoogleCredentials; +import java.io.IOException; +import java.util.Collections; + +/* Class to demonstrate the use of Classroom Return StudentSubmissions API. */ +public class ReturnStudentSubmission { + /** + * Return a student submission back to the student which updates the submission state to `RETURNED`. + * + * @param courseId - identifier of the course. + * @param courseWorkId - identifier of the course work. + * @param id - identifier of the student submission. + * @throws IOException - if credentials file not found. + */ + public static void returnSubmission(String courseId, String courseWorkId, String id) + throws IOException { + /* Load pre-authorized user credentials from the environment. + TODO(developer) - See https://developers.google.com/identity for + guides on implementing OAuth2 for your application. */ + GoogleCredentials credentials = GoogleCredentials.getApplicationDefault() + .createScoped(Collections.singleton(ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS)); + HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter( + credentials); + + // Create the classroom API client. + Classroom service = new Classroom.Builder(new NetHttpTransport(), + GsonFactory.getDefaultInstance(), + requestInitializer) + .setApplicationName("Classroom samples") + .build(); + + // [START classroom_return_student_submissions_code_snippet] + + try { + service.courses().courseWork().studentSubmissions() + .classroomReturn(courseId, courseWorkId, id, null) + .execute(); + } catch (GoogleJsonResponseException e) { + //TODO (developer) - handle error appropriately + GoogleJsonError error = e.getDetails(); + if (error.getCode() == 404) { + System.out.printf("The courseId (%s), courseWorkId (%s), or studentSubmissionId (%s) does " + + "not exist.\n", courseId, courseWorkId, id); + } else { + throw e; + } + } catch (Exception e) { + throw e; + } + + // [END classroom_return_student_submissions_code_snippet] + + } +} +// [END classroom_return_student_submissions_class] diff --git a/classroom/snippets/src/main/java/UpdateTopic.java b/classroom/snippets/src/main/java/UpdateTopic.java index 770bee30..f45ffeca 100644 --- a/classroom/snippets/src/main/java/UpdateTopic.java +++ b/classroom/snippets/src/main/java/UpdateTopic.java @@ -69,7 +69,10 @@ public static Topic updateTopic(String courseId, String topicId) throws IOExcept topic = service.courses().topics().patch(courseId, topicId, topicToUpdate) .set("updateMask", "name") .execute(); - } catch(GoogleJsonResponseException e) { + + /* Prints the updated topic. */ + System.out.printf("Topic '%s' updated.\n", topic.getName()); + } catch (GoogleJsonResponseException e) { // TODO(developer) - handle error appropriately GoogleJsonError error = e.getDetails(); if (error.getCode() == 404) { diff --git a/classroom/snippets/src/test/java/TestListSubmissions.java b/classroom/snippets/src/test/java/TestListSubmissions.java new file mode 100644 index 00000000..148e9529 --- /dev/null +++ b/classroom/snippets/src/test/java/TestListSubmissions.java @@ -0,0 +1,31 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import com.google.api.services.classroom.model.StudentSubmission; +import java.io.IOException; +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +// Unit test class for ListSubmissions classroom snippet +public class TestListSubmissions extends BaseTest { + + @Test + public void testListSubmissions() throws IOException { + List submissions = ListSubmissions.listSubmissions( + testCourse.getId(), + "-"); + Assert.assertNotNull("No submissions returned.", submissions); + } +}