use of de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult 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.text.TextPlagiarismResult 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.text.TextPlagiarismResult in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveInstructorStatementForUnknownStudent.
/**
* Checks the method updatePlagiarismComparisonInstructorStatement for unknown student
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveInstructorStatementForUnknownStudent() 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);
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/instructor-statement/student42", new PlagiarismResource.PlagiarismStatementDTO(), HttpStatus.NOT_FOUND);
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveStudentStatementForUnknownStudent.
/**
* Checks the method updatePlagiarismComparisonStudentStatement for unknown student
*/
@Test
@WithMockUser(username = "student3", roles = "USER")
public void saveStudentStatementForUnknownStudent() 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<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
submissionA.setStudentLogin("student1");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparison.setInstructorStatementA(INSTRUCTOR_STATEMENT_A);
PlagiarismSubmission<TextSubmissionElement> submissionB = new PlagiarismSubmission<>();
submissionB.setStudentLogin("student2");
plagiarismComparison.setSubmissionB(submissionB);
plagiarismComparison.setInstructorStatementB(INSTRUCTOR_STATEMENT_B);
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.FORBIDDEN);
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult in project Artemis by ls1intum.
the class SingleUserNotificationServiceTest method setUp.
/**
* Sets up all needed mocks and their wanted behavior
*/
@BeforeEach
public void setUp() {
SecurityUtils.setAuthorizationObject();
course = database.createCourse();
List<User> users = database.addUsers(3, 0, 0, 0);
user = users.get(0);
exercise = new TextExercise();
exercise.setCourse(course);
exercise.setMaxPoints(10D);
fileUploadExercise = new FileUploadExercise();
fileUploadExercise.setCourse(course);
Lecture lecture = new Lecture();
lecture.setCourse(course);
post = new Post();
post.setExercise(exercise);
post.setLecture(lecture);
post.setAuthor(user);
post.setCourse(course);
PlagiarismSubmission<TextSubmissionElement> plagiarismSubmission = new PlagiarismSubmission<>();
plagiarismSubmission.setStudentLogin(user.getLogin());
TextPlagiarismResult plagiarismResult = new TextPlagiarismResult();
plagiarismResult.setExercise(exercise);
plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setSubmissionA(plagiarismSubmission);
plagiarismComparison.setPlagiarismResult(plagiarismResult);
plagiarismCase = new PlagiarismCase();
plagiarismCase.setExercise(exercise);
result = new Result();
result.setScore(1D);
result.setCompletionDate(ZonedDateTime.now().minusMinutes(1));
doNothing().when(javaMailSender).send(any(MimeMessage.class));
}
Aggregations