use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.
the class TextAssessmentIntegrationTest method retrieveParticipationForNonExistingSubmission.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void retrieveParticipationForNonExistingSubmission() throws Exception {
StudentParticipation participation = request.get("/api/participations/1/submissions/345395769256365/for-text-assessment", HttpStatus.NOT_FOUND, StudentParticipation.class);
assertThat(participation).as("participation should not be found").isNull();
}
use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.
the class TextAssessmentIntegrationTest method getTextSubmissionWithResultId.
@Test
@WithMockUser(username = "instructor1", roles = "TA")
public void getTextSubmissionWithResultId() throws Exception {
TextSubmission submission = ModelFactory.generateTextSubmission("asdf", null, true);
submission = (TextSubmission) database.addSubmissionWithTwoFinishedResultsWithAssessor(textExercise, submission, "student1", "tutor1");
Result storedResult = submission.getResultForCorrectionRound(1);
var params = new LinkedMultiValueMap<String, String>();
params.add("resultId", String.valueOf(storedResult.getId()));
StudentParticipation participation = request.get("/api/participations/" + submission.getParticipation().getId() + "/submissions/" + submission.getId() + "/for-text-assessment", HttpStatus.OK, StudentParticipation.class, params);
assertThat(participation.getResults()).isNotNull().contains(storedResult);
}
use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.
the class TextAssessmentIntegrationTest method retrieveParticipationForSubmission_studentHidden.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void retrieveParticipationForSubmission_studentHidden() throws Exception {
TextSubmission textSubmission = ModelFactory.generateTextSubmission("Some text", Language.ENGLISH, false);
textSubmission = database.saveTextSubmission(textExercise, textSubmission, "student1");
StudentParticipation participationWithoutAssessment = request.get("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/for-text-assessment", HttpStatus.OK, StudentParticipation.class);
assertThat(participationWithoutAssessment).as("participation with submission was found").isNotNull();
assertThat(participationWithoutAssessment.getSubmissions().iterator().next().getId()).as("participation with correct text submission was found").isEqualTo(textSubmission.getId());
assertThat(participationWithoutAssessment.getStudent()).as("student of participation is hidden").isEmpty();
}
use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.
the class TextAssessmentIntegrationTest method retrieveParticipationForLockedSubmission.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void retrieveParticipationForLockedSubmission() throws Exception {
TextSubmission textSubmission = ModelFactory.generateTextSubmission("Some text", Language.ENGLISH, false);
textSubmission = database.saveTextSubmissionWithResultAndAssessor(textExercise, textSubmission, "student1", "tutor2");
Result result = textSubmission.getLatestResult();
// assessment is still in progress for this test
result.setCompletionDate(null);
resultRepo.save(result);
StudentParticipation participation = request.get("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/for-text-assessment", HttpStatus.LOCKED, StudentParticipation.class);
assertThat(participation).as("participation is locked and should not be returned").isNull();
}
use of de.tum.in.www1.artemis.domain.participation.StudentParticipation in project ArTEMiS by ls1intum.
the class TextClusterResourceIntegrationTest method initTestCase.
/**
* Initializes the database with a course that contains a tutor and a text submission
*/
@BeforeEach
public void initTestCase() throws Error {
Course course = database.createCourseWithInstructorAndTextExercise();
exercise = course.getExercises().iterator().next();
StudentParticipation studentParticipation = studentParticipationRepository.findAll().get(0);
TextSubmission textSubmission = ModelFactory.generateTextSubmission("This is Part 1, and this is Part 2. There is also Part 3.", Language.ENGLISH, true);
textSubmissionRepository.save(textSubmission);
database.addResultToSubmission(textSubmission, AssessmentType.AUTOMATIC);
Set<TextBlock> textBlocks = Set.of(new TextBlock().text("This is Part 1,").startIndex(0).endIndex(15).automatic(), new TextBlock().text("and this is Part 2.").startIndex(16).endIndex(35).automatic(), new TextBlock().text("There is also Part 3.").startIndex(36).endIndex(57).automatic());
int[] clusterSizes = { 3 };
List<TextCluster> clusters = textExerciseUtilService.addTextBlocksToCluster(textBlocks, clusterSizes, (TextExercise) exercise);
clusters.get(0).setDisabled(true);
textBlocks.forEach(block -> {
block.setSubmission(textSubmission);
block.setCluster(clusters.get(0));
block.computeId();
});
textSubmission.setParticipation(studentParticipation);
textSubmissionRepository.save(textSubmission);
textClusterRepository.saveAll(clusters);
textBlockRepository.saveAll(textBlocks);
}
Aggregations