use of de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation in project Artemis by ls1intum.
the class ResultServiceTest method testGetFeedbacksForResultAsStudent_shouldFilterInCourseAfterAssessmentDueDateWithAutomaticResult.
@Test
@WithMockUser(username = "student1", roles = "STUDENT")
public void testGetFeedbacksForResultAsStudent_shouldFilterInCourseAfterAssessmentDueDateWithAutomaticResult() {
programmingExercise.setDueDate(ZonedDateTime.now().minusDays(4));
programmingExercise.setAssessmentDueDate(ZonedDateTime.now().minusDays(2));
programmingExerciseRepository.save(programmingExercise);
Result result = database.addResultToParticipation(AssessmentType.AUTOMATIC, null, programmingExerciseStudentParticipation);
result = database.addVariousVisibilityFeedbackToResults(result);
result = database.addFeedbackToResult(ModelFactory.createPositiveFeedback(FeedbackType.MANUAL), result);
List<Feedback> expectedFeedbacks = result.getFeedbacks().stream().filter(feedback -> !feedback.isInvisible()).collect(Collectors.toList());
assertThat(resultService.getFeedbacksForResult(result)).isEqualTo(expectedFeedbacks);
}
use of de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation in project Artemis by ls1intum.
the class ResultServiceTest method testGetFeedbacksForResultAsStudentShouldOnlyFilterAutomaticResultBeforeLastDueDate.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@EnumSource(AssessmentType.class)
@WithMockUser(username = "student1", roles = "STUDENT")
public void testGetFeedbacksForResultAsStudentShouldOnlyFilterAutomaticResultBeforeLastDueDate(AssessmentType assessmentType) {
programmingExercise.setDueDate(ZonedDateTime.now().minusHours(2));
programmingExercise.setAssessmentDueDate(null);
programmingExercise = programmingExerciseRepository.save(programmingExercise);
final var participation2 = database.addStudentParticipationForProgrammingExercise(programmingExercise, "student2");
participation2.setIndividualDueDate(ZonedDateTime.now().plusDays(2));
participationRepository.save(participation2);
Result result = database.addResultToParticipation(assessmentType, null, programmingExerciseStudentParticipation);
result = database.addVariousVisibilityFeedbackToResults(result);
result = database.addFeedbackToResult(ModelFactory.createPositiveFeedback(FeedbackType.MANUAL), result);
List<Feedback> expectedFeedbacks;
if (AssessmentType.AUTOMATIC == assessmentType) {
expectedFeedbacks = result.getFeedbacks().stream().filter(feedback -> !feedback.isInvisible() && !feedback.isAfterDueDate()).collect(Collectors.toList());
assertThat(expectedFeedbacks).hasSize(2);
} else {
expectedFeedbacks = result.getFeedbacks().stream().filter(feedback -> !feedback.isInvisible()).collect(Collectors.toList());
assertThat(expectedFeedbacks).hasSize(3);
}
assertThat(resultService.getFeedbacksForResult(result)).isEqualTo(expectedFeedbacks);
}
use of de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation in project Artemis by ls1intum.
the class ResultServiceTest method testGetFeedbacksForResultAsStudentShouldNotFilterAfterLatestDueDate.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@EnumSource(AssessmentType.class)
@WithMockUser(username = "student1", roles = "STUDENT")
public void testGetFeedbacksForResultAsStudentShouldNotFilterAfterLatestDueDate(AssessmentType assessmentType) {
programmingExercise.setDueDate(ZonedDateTime.now().minusHours(2));
programmingExercise.setAssessmentDueDate(null);
programmingExercise = programmingExerciseRepository.save(programmingExercise);
final var participation2 = database.addStudentParticipationForProgrammingExercise(programmingExercise, "student2");
participation2.setIndividualDueDate(ZonedDateTime.now().minusHours(1));
participationRepository.save(participation2);
Result result = database.addResultToParticipation(assessmentType, null, programmingExerciseStudentParticipation);
result = database.addVariousVisibilityFeedbackToResults(result);
result = database.addFeedbackToResult(ModelFactory.createPositiveFeedback(FeedbackType.MANUAL), result);
List<Feedback> expectedFeedbacks;
expectedFeedbacks = result.getFeedbacks().stream().filter(feedback -> !feedback.isInvisible()).collect(Collectors.toList());
assertThat(expectedFeedbacks).hasSize(3);
assertThat(resultService.getFeedbacksForResult(result)).isEqualTo(expectedFeedbacks);
}
use of de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation in project Artemis by ls1intum.
the class ResultServiceTest method testGetFeedbacksForResultAsStudent_shouldFilterInCourseBeforeDueDate.
@Test
@WithMockUser(username = "student1", roles = "STUDENT")
public void testGetFeedbacksForResultAsStudent_shouldFilterInCourseBeforeDueDate() {
programmingExercise.setDueDate(ZonedDateTime.now().plusDays(2));
programmingExerciseRepository.save(programmingExercise);
Result result = database.addResultToParticipation(null, null, programmingExerciseStudentParticipation);
result = database.addVariousVisibilityFeedbackToResults(result);
List<Feedback> expectedFeedbacks = result.getFeedbacks().stream().filter(feedback -> !feedback.isInvisible() && !feedback.isAfterDueDate()).collect(Collectors.toList());
assertThat(resultService.getFeedbacksForResult(result)).isEqualTo(expectedFeedbacks);
}
use of de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation in project Artemis by ls1intum.
the class UrlServiceTest method testUserIndependentRepositoryUrl.
@Test
public void testUserIndependentRepositoryUrl() {
var solutionProgrammingExerciseParticipation = new SolutionProgrammingExerciseParticipation();
solutionProgrammingExerciseParticipation.setRepositoryUrl(repositoryUrl1.toString());
assertThat(solutionProgrammingExerciseParticipation.getUserIndependentRepositoryUrl()).isEqualTo("https://bitbucket.ase.in.tum.de/scm/EIST2016RME/RMEXERCISE-ab123cd");
var templateProgrammingExerciseParticipation = new TemplateProgrammingExerciseParticipation();
templateProgrammingExerciseParticipation.setRepositoryUrl(repositoryUrl2.toString());
assertThat(templateProgrammingExerciseParticipation.getUserIndependentRepositoryUrl()).isEqualTo("https://repobruegge.in.tum.de/scm/EIST2016RME/RMEXERCISE-ab123cd.git");
var studentParticipation1 = new ProgrammingExerciseStudentParticipation();
studentParticipation1.setRepositoryUrl(repositoryUrl3.toString());
assertThat(studentParticipation1.getUserIndependentRepositoryUrl()).isEqualTo("https://artemistest2gitlab.ase.in.tum.de/TESTADAPTER/testadapter-exercise.git");
var studentParticipation2 = new ProgrammingExerciseStudentParticipation();
studentParticipation2.setRepositoryUrl(repositoryUrl4.toString());
assertThat(studentParticipation2.getUserIndependentRepositoryUrl()).isEqualTo("https://artemistest2gitlab.ase.in.tum.de/FTCSCAGRADING1/ftcscagrading1-username");
assertThat(new ProgrammingExerciseStudentParticipation().getUserIndependentRepositoryUrl()).isNull();
var studentParticipation3 = new ProgrammingExerciseStudentParticipation();
studentParticipation3.setRepositoryUrl("http://localhost:8080/Assignment/rest/words/{name}/protection");
assertThat(studentParticipation3.getUserIndependentRepositoryUrl()).isNull();
}
Aggregations