use of de.tum.in.www1.artemis.web.rest.dto.TextAssessmentUpdateDTO in project ArTEMiS by ls1intum.
the class TextAssessmentIntegrationTest method updateTextAssessmentAfterComplaint_withTextBlocks.
@Test
@WithMockUser(username = "tutor2", roles = "TA")
public void updateTextAssessmentAfterComplaint_withTextBlocks() throws Exception {
// Setup
TextSubmission textSubmission = ModelFactory.generateTextSubmission("This is Part 1, and this is Part 2. There is also Part 3.", Language.ENGLISH, true);
textSubmission = database.saveTextSubmissionWithResultAndAssessor(textExercise, textSubmission, "student1", "tutor1");
database.addAndSaveTextBlocksToTextSubmission(Set.of(new TextBlock().startIndex(0).endIndex(15).automatic(), new TextBlock().startIndex(16).endIndex(35).automatic(), new TextBlock().startIndex(36).endIndex(57).automatic()), textSubmission);
Result textAssessment = textSubmission.getLatestResult();
complaintRepo.save(new Complaint().result(textAssessment).complaintText("This is not fair"));
// Get Text Submission and Complaint
StudentParticipation participation = request.get("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/for-text-assessment", HttpStatus.OK, StudentParticipation.class);
final Complaint complaint = request.get("/api/complaints/submissions/" + textSubmission.getId(), HttpStatus.OK, Complaint.class);
// Accept Complaint and update Assessment
ComplaintResponse complaintResponse = database.createInitialEmptyResponse("tutor2", complaint);
complaintResponse.getComplaint().setAccepted(false);
complaintResponse.setResponseText("rejected");
TextAssessmentUpdateDTO assessmentUpdate = new TextAssessmentUpdateDTO();
assessmentUpdate.feedbacks(new ArrayList<>()).complaintResponse(complaintResponse);
assessmentUpdate.setTextBlocks(new HashSet<>());
Result updatedResult = request.putWithResponseBody("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/text-assessment-after-complaint", assessmentUpdate, Result.class, HttpStatus.OK);
assertThat(updatedResult).as("updated result found").isNotNull();
}
use of de.tum.in.www1.artemis.web.rest.dto.TextAssessmentUpdateDTO in project Artemis by ls1intum.
the class TextAssessmentIntegrationTest method updateTextAssessmentAfterComplaint_withTextBlocks.
@Test
@WithMockUser(username = "tutor2", roles = "TA")
public void updateTextAssessmentAfterComplaint_withTextBlocks() throws Exception {
// Setup
TextSubmission textSubmission = ModelFactory.generateTextSubmission("This is Part 1, and this is Part 2. There is also Part 3.", Language.ENGLISH, true);
textSubmission = database.saveTextSubmissionWithResultAndAssessor(textExercise, textSubmission, "student1", "tutor1");
database.addAndSaveTextBlocksToTextSubmission(Set.of(new TextBlock().startIndex(0).endIndex(15).automatic(), new TextBlock().startIndex(16).endIndex(35).automatic(), new TextBlock().startIndex(36).endIndex(57).automatic()), textSubmission);
Result textAssessment = textSubmission.getLatestResult();
complaintRepo.save(new Complaint().result(textAssessment).complaintText("This is not fair"));
// Get Text Submission and Complaint
StudentParticipation participation = request.get("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/for-text-assessment", HttpStatus.OK, StudentParticipation.class);
final Complaint complaint = request.get("/api/complaints/submissions/" + textSubmission.getId(), HttpStatus.OK, Complaint.class);
// Accept Complaint and update Assessment
ComplaintResponse complaintResponse = database.createInitialEmptyResponse("tutor2", complaint);
complaintResponse.getComplaint().setAccepted(false);
complaintResponse.setResponseText("rejected");
TextAssessmentUpdateDTO assessmentUpdate = new TextAssessmentUpdateDTO();
assessmentUpdate.feedbacks(new ArrayList<>()).complaintResponse(complaintResponse);
assessmentUpdate.setTextBlocks(new HashSet<>());
Result updatedResult = request.putWithResponseBody("/api/participations/" + textSubmission.getParticipation().getId() + "/submissions/" + textSubmission.getId() + "/text-assessment-after-complaint", assessmentUpdate, Result.class, HttpStatus.OK);
assertThat(updatedResult).as("updated result found").isNotNull();
}
Aggregations