use of de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method updatePlagiarismComparisonFinalStatusForStudentB.
/**
* Checks the method updatePlagiarismComparisonFinalStatus for second (B) user
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void updatePlagiarismComparisonFinalStatusForStudentB() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
PlagiarismSubmission<TextSubmissionElement> submissionB = new PlagiarismSubmission<>();
submissionB.setStudentLogin("student2");
plagiarismComparison.setInstructorStatementB(INSTRUCTOR_STATEMENT_B);
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison.setStatusB(PlagiarismStatus.NONE);
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparison.setSubmissionB(submissionB);
plagiarismComparisonRepository.save(plagiarismComparison);
var plagiarismComparisonStatus = new PlagiarismComparisonStatusDTO();
plagiarismComparisonStatus.setStatus(PlagiarismStatus.CONFIRMED);
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/final-status/student2", plagiarismComparisonStatus, HttpStatus.OK);
var updatedPlagiarismComparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(updatedPlagiarismComparison.getStatusB()).as("should update status for studentB").isEqualTo(PlagiarismStatus.CONFIRMED);
}
use of de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveInstructorStatementForStudentB.
/**
* Checks the method updatePlagiarismComparisonInstructorStatement for student B
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveInstructorStatementForStudentB() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
PlagiarismSubmission<TextSubmissionElement> submissionB = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
submissionB.setStudentLogin("student2");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparison.setSubmissionB(submissionB);
plagiarismComparisonRepository.save(plagiarismComparison);
var statement = new PlagiarismResource.PlagiarismStatementDTO();
statement.statement = "test statement";
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/instructor-statement/student2", statement, HttpStatus.OK);
var comparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(comparison.getInstructorStatementB()).as("should update instructor statement").isEqualTo("test statement");
}
use of de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method updatePlagiarismComparisonFinalStatusForStudentA.
/**
* Checks the method updatePlagiarismComparisonFinalStatus as instructor
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void updatePlagiarismComparisonFinalStatusForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setInstructorStatementA(INSTRUCTOR_STATEMENT_A);
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison.setStatusA(PlagiarismStatus.NONE);
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var plagiarismComparisonStatus = new PlagiarismComparisonStatusDTO();
plagiarismComparisonStatus.setStatus(PlagiarismStatus.CONFIRMED);
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/final-status/student1", plagiarismComparisonStatus, HttpStatus.OK);
var updatedPlagiarismComparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(updatedPlagiarismComparison.getStatusA()).as("should update status for studentA").isEqualTo(PlagiarismStatus.CONFIRMED);
}
use of de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveStudentStatementForStudentA.
/**
* Checks the method updatePlagiarismComparisonStudentStatement for student A
*/
@Test
@WithMockUser(username = "student1", roles = "USER")
public void saveStudentStatementForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison.setInstructorStatementA(INSTRUCTOR_STATEMENT_A);
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var statement = new PlagiarismResource.PlagiarismStatementDTO();
statement.statement = "test statement";
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/student-statement", statement, HttpStatus.OK);
var comparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(comparison.getStudentStatementA()).as("should update student statement").isEqualTo("test statement");
}
use of de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveInstructorStatementForStudentA.
/**
* Checks the method updatePlagiarismComparisonInstructorStatement for student A
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveInstructorStatementForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var statement = new PlagiarismResource.PlagiarismStatementDTO();
statement.statement = "test statement";
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/instructor-statement/student1", statement, HttpStatus.OK);
var comparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(comparison.getInstructorStatementA()).as("should update instructor statement").isEqualTo("test statement");
}
Aggregations