Skip to content
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package edu.ksu.canvas.requestOptions;

import java.util.List;
import java.util.Objects;

public class GetSingleAssignmentOptions extends BaseOptions {

private String courseId;
private Integer assignmentId;
private String assignmentId;

public enum Include {
SUBMISSION, ASSIGNMENT_VISIBILITY, OVERRIDES, OBSERVED_USERS;
Expand All @@ -16,19 +17,23 @@ public String toString() {
}
}

public GetSingleAssignmentOptions(String courseId, Integer assignmentId) {
public GetSingleAssignmentOptions(String courseId, String assignmentId) {
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new functionality allowing String assignment IDs (e.g., "lti_context_id:ab84f579-4442-4d4a-acd8-85c5ec6fd2b6") lacks test coverage. While existing tests will continue to work through the backward-compatible Integer constructor, there should be a test that verifies the String constructor works correctly with non-numeric IDs, ensuring the URL is properly constructed and the API call succeeds.

Copilot uses AI. Check for mistakes.
if(courseId == null || assignmentId == null) {
throw new IllegalArgumentException("Course and assignment IDs are required");
}
this.courseId = courseId;
this.assignmentId = assignmentId;
}
Comment on lines +20 to 26
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor Javadoc (inherited from line 17-21 in AssignmentReader) states it retrieves "a specific assignment from Canvas by its Canvas ID number", but this is now outdated since the constructor accepts String to support non-numeric identifiers like "lti_context_id:...". Consider updating the documentation to clarify that it accepts either a numeric Canvas ID or a qualified identifier (e.g., "lti_context_id:abc123"), similar to how GetSingleCourseOptions documents "May be of the form sis_course_id:abc123".

Copilot uses AI. Check for mistakes.

public GetSingleAssignmentOptions(String courseId, Integer assignmentId) {
this(courseId, Objects.toString(assignmentId, null));
}

public String getCourseId() {
return courseId;
}

public Integer getAssignmentId() {
public String getAssignmentId() {
return assignmentId;
}

Expand Down