use of de.tum.in.www1.artemis.domain.quiz.QuizSubmission in project ArTEMiS by ls1intum.
the class ResultServiceIntegrationTest method testGetResultsForQuizExercise.
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void testGetResultsForQuizExercise() throws Exception {
var now = ZonedDateTime.now();
QuizExercise quizExercise = database.createQuiz(course, now.minusMinutes(5), now.minusMinutes(2));
quizExerciseRepository.save(quizExercise);
for (int i = 1; i <= 10; i++) {
QuizSubmission quizSubmission = new QuizSubmission();
quizSubmission.setScoreInPoints(2.0);
quizSubmission.submitted(true);
quizSubmission.submissionDate(now.minusHours(3));
database.addSubmission(quizExercise, quizSubmission, "student" + i);
if (i % 3 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 10D, true);
} else if (i % 4 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 20D, true);
}
}
List<Result> results = request.getList("/api/exercises/" + quizExercise.getId() + "/results", HttpStatus.OK, Result.class);
assertThat(results).hasSize(5);
// TODO: check additional values
}
Aggregations