use of de.tum.in.www1.artemis.domain.scores.ParticipantScore in project Artemis by ls1intum.
the class ResultListenerIntegrationTest method saveRatedResult_then_saveAnotherUnratedResult_then_removeRatedResult_ShouldUpdateOriginalStudentScore.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@ValueSource(booleans = { true, false })
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveRatedResult_then_saveAnotherUnratedResult_then_removeRatedResult_ShouldUpdateOriginalStudentScore(boolean isTeamTest) {
ParticipantScore originalParticipantScore = setupTestScenarioWithOneResultSaved(true, isTeamTest);
Result originalResult = originalParticipantScore.getLastResult();
// creating a new rated result should trigger the entity listener and update the student score BUT only the not rated part
Result newResult = createNewResult(isTeamTest, false);
verifyStructureOfParticipantScoreInDatabase(isTeamTest, newResult.getId(), newResult.getScore(), originalResult.getId(), originalResult.getScore());
resultRepository.deleteById(originalResult.getId());
List<Result> savedResults = resultRepository.findAll();
assertThat(savedResults).hasSize(1);
verifyStructureOfParticipantScoreInDatabase(isTeamTest, newResult.getId(), newResult.getScore(), null, null);
}
use of de.tum.in.www1.artemis.domain.scores.ParticipantScore in project Artemis by ls1intum.
the class ResultListenerIntegrationTest method saveUnratedResult_then_saveAnotherRatedResult_thenRemoveSecondResult_ShouldUpdateStudentScore.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@ValueSource(booleans = { true, false })
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveUnratedResult_then_saveAnotherRatedResult_thenRemoveSecondResult_ShouldUpdateStudentScore(boolean isTeamTest) {
ParticipantScore originalParticipantScore = setupTestScenarioWithOneResultSaved(false, isTeamTest);
Result originalResult = originalParticipantScore.getLastResult();
// creating a new rated result should trigger the entity listener and update the student score BUT only the not rated part
Result newResult = createNewResult(isTeamTest, true);
verifyStructureOfParticipantScoreInDatabase(isTeamTest, newResult.getId(), newResult.getScore(), newResult.getId(), newResult.getScore());
resultRepository.deleteById(newResult.getId());
List<Result> savedResults = resultRepository.findAll();
assertThat(savedResults).hasSize(1);
verifyStructureOfParticipantScoreInDatabase(isTeamTest, originalResult.getId(), originalResult.getScore(), null, null);
}
use of de.tum.in.www1.artemis.domain.scores.ParticipantScore in project Artemis by ls1intum.
the class ResultListenerIntegrationTest method saveRatedResult_then_saveAnotherUnratedResult_ShouldUpdateOriginalStudentScore.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@ValueSource(booleans = { true, false })
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveRatedResult_then_saveAnotherUnratedResult_ShouldUpdateOriginalStudentScore(boolean isTeamTest) {
ParticipantScore originalStudentScore = setupTestScenarioWithOneResultSaved(true, isTeamTest);
Result originalResult = originalStudentScore.getLastResult();
// creating a new rated result should trigger the entity listener and update the student score BUT only the not rated part
Result newResult = createNewResult(isTeamTest, false);
verifyStructureOfParticipantScoreInDatabase(isTeamTest, newResult.getId(), newResult.getScore(), originalResult.getId(), originalResult.getScore());
}
Aggregations