Skip to content

Commit

Permalink
Development: Add JavaDocs to UtilServices and Factories [8] (#7374)
Browse files Browse the repository at this point in the history
  • Loading branch information
laadvo authored Oct 29, 2023
1 parent 75d3961 commit 85eaf66
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
import de.tum.in.www1.artemis.domain.Course;
import de.tum.in.www1.artemis.domain.User;
import de.tum.in.www1.artemis.domain.exam.Exam;
import de.tum.in.www1.artemis.domain.quiz.DragAndDropQuestion;
import de.tum.in.www1.artemis.domain.quiz.MultipleChoiceQuestion;
import de.tum.in.www1.artemis.domain.quiz.QuizGroup;
import de.tum.in.www1.artemis.domain.quiz.QuizPool;
import de.tum.in.www1.artemis.domain.quiz.QuizQuestion;
import de.tum.in.www1.artemis.domain.quiz.ShortAnswerQuestion;
import de.tum.in.www1.artemis.domain.quiz.*;

Check warning on line 20 in src/test/java/de/tum/in/www1/artemis/exam/QuizPoolIntegrationTest.java

View check run for this annotation

Teamscale / teamscale-findings

src/test/java/de/tum/in/www1/artemis/exam/QuizPoolIntegrationTest.java#L20

[New] Star import of `de.tum.in.www1.artemis.domain.quiz.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=development%2Fadd-javadoc-to-utilservices-and-factories%2Fmain%3AHEAD&id=311306AE28EE1AF1C9A9C30E1EDC9646
import de.tum.in.www1.artemis.exercise.quizexercise.QuizExerciseFactory;
import de.tum.in.www1.artemis.exercise.quizexercise.QuizExerciseUtilService;
import de.tum.in.www1.artemis.service.QuizPoolService;
import de.tum.in.www1.artemis.user.UserUtilService;
import de.tum.in.www1.artemis.util.RequestUtilService;
Expand All @@ -42,9 +36,6 @@ class QuizPoolIntegrationTest extends AbstractSpringIntegrationBambooBitbucketJi
@Autowired
private ExamUtilService examUtilService;

@Autowired
private QuizExerciseUtilService quizExerciseUtilService;

@Autowired
private UserUtilService userUtilService;

Expand Down Expand Up @@ -91,10 +82,10 @@ void testCreateQuizPoolSuccessful() throws Exception {
void testUpdateQuizPoolSuccessful() throws Exception {
QuizPool quizPool = createQuizPool();

QuizGroup quizGroup3 = quizExerciseUtilService.createQuizGroup("Exception Handling");
QuizQuestion saQuizQuestion1 = quizExerciseUtilService.createShortAnswerQuestionWithTitleAndGroup("SA 1", quizGroup2);
QuizQuestion saQuizQuestion2 = quizExerciseUtilService.createShortAnswerQuestionWithTitleAndGroup("SA 2", quizGroup3);
QuizQuestion saQuizQuestion3 = quizExerciseUtilService.createShortAnswerQuestionWithTitleAndGroup("SA 3", null);
QuizGroup quizGroup3 = QuizExerciseFactory.createQuizGroup("Exception Handling");
QuizQuestion saQuizQuestion1 = QuizExerciseFactory.createShortAnswerQuestionWithTitleAndGroup("SA 1", quizGroup2);
QuizQuestion saQuizQuestion2 = QuizExerciseFactory.createShortAnswerQuestionWithTitleAndGroup("SA 2", quizGroup3);
QuizQuestion saQuizQuestion3 = QuizExerciseFactory.createShortAnswerQuestionWithTitleAndGroup("SA 3", null);
quizPool.setQuizGroups(List.of(quizPool.getQuizGroups().get(0), quizPool.getQuizGroups().get(2), quizGroup3));
quizPool.setQuizQuestions(List.of(quizPool.getQuizQuestions().get(0), quizPool.getQuizQuestions().get(1), quizPool.getQuizQuestions().get(2), saQuizQuestion1,
saQuizQuestion2, saQuizQuestion3));
Expand Down Expand Up @@ -165,11 +156,11 @@ void testUpdateQuizPoolNotFoundExam() throws Exception {
@Test
@WithMockUser(username = TEST_PREFIX + "instructor1", roles = "INSTRUCTOR")
void testGetQuizPoolSuccessful() throws Exception {
QuizGroup quizGroup0 = quizExerciseUtilService.createQuizGroup("Encapsulation");
QuizGroup quizGroup1 = quizExerciseUtilService.createQuizGroup("Inheritance");
QuizQuestion mcQuizQuestion = quizExerciseUtilService.createMultipleChoiceQuestionWithTitleAndGroup("MC", quizGroup0);
QuizQuestion dndQuizQuestion = quizExerciseUtilService.createDragAndDropQuestionWithTitleAndGroup("DND", quizGroup1);
QuizQuestion saQuizQuestion = quizExerciseUtilService.createShortAnswerQuestionWithTitleAndGroup("SA", null);
QuizGroup quizGroup0 = QuizExerciseFactory.createQuizGroup("Encapsulation");
QuizGroup quizGroup1 = QuizExerciseFactory.createQuizGroup("Inheritance");
QuizQuestion mcQuizQuestion = QuizExerciseFactory.createMultipleChoiceQuestionWithTitleAndGroup("MC", quizGroup0);
QuizQuestion dndQuizQuestion = QuizExerciseFactory.createDragAndDropQuestionWithTitleAndGroup("DND", quizGroup1);
QuizQuestion saQuizQuestion = QuizExerciseFactory.createShortAnswerQuestionWithTitleAndGroup("SA", null);
quizPool.setQuizGroups(List.of(quizGroup0, quizGroup1));
quizPool.setQuizQuestions(List.of(mcQuizQuestion, dndQuizQuestion, saQuizQuestion));
QuizPool savedQuizPool = quizPoolService.update(exam.getId(), quizPool);
Expand All @@ -190,14 +181,14 @@ void testGetQuizPoolNotFoundExam() throws Exception {
}

private QuizPool createQuizPool() throws Exception {
quizGroup0 = quizExerciseUtilService.createQuizGroup("Encapsulation");
quizGroup1 = quizExerciseUtilService.createQuizGroup("Inheritance");
quizGroup2 = quizExerciseUtilService.createQuizGroup("Polymorphism");
QuizQuestion mcQuizQuestion0 = quizExerciseUtilService.createMultipleChoiceQuestionWithTitleAndGroup("MC 0", quizGroup0);
QuizQuestion mcQuizQuestion1 = quizExerciseUtilService.createMultipleChoiceQuestionWithTitleAndGroup("MC 1", quizGroup0);
QuizQuestion dndQuizQuestion0 = quizExerciseUtilService.createDragAndDropQuestionWithTitleAndGroup("DND 0", quizGroup1);
QuizQuestion dndQuizQuestion1 = quizExerciseUtilService.createDragAndDropQuestionWithTitleAndGroup("DND 1", quizGroup2);
QuizQuestion saQuizQuestion0 = quizExerciseUtilService.createShortAnswerQuestionWithTitleAndGroup("SA 0", null);
quizGroup0 = QuizExerciseFactory.createQuizGroup("Encapsulation");
quizGroup1 = QuizExerciseFactory.createQuizGroup("Inheritance");
quizGroup2 = QuizExerciseFactory.createQuizGroup("Polymorphism");
QuizQuestion mcQuizQuestion0 = QuizExerciseFactory.createMultipleChoiceQuestionWithTitleAndGroup("MC 0", quizGroup0);
QuizQuestion mcQuizQuestion1 = QuizExerciseFactory.createMultipleChoiceQuestionWithTitleAndGroup("MC 1", quizGroup0);
QuizQuestion dndQuizQuestion0 = QuizExerciseFactory.createDragAndDropQuestionWithTitleAndGroup("DND 0", quizGroup1);
QuizQuestion dndQuizQuestion1 = QuizExerciseFactory.createDragAndDropQuestionWithTitleAndGroup("DND 1", quizGroup2);
QuizQuestion saQuizQuestion0 = QuizExerciseFactory.createShortAnswerQuestionWithTitleAndGroup("SA 0", null);
quizPool.setQuizGroups(List.of(quizGroup0, quizGroup1, quizGroup2));
quizPool.setQuizQuestions(List.of(mcQuizQuestion0, mcQuizQuestion1, dndQuizQuestion0, dndQuizQuestion1, saQuizQuestion0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ public Submission addModelingSubmissionWithFinishedResultAndAssessor(ModelingExe
return participationUtilService.addSubmissionWithFinishedResultsWithAssessor(participation, submission, assessorLogin);
}


/**
* Creates and saves a ModelingSubmission from a file.
*
Expand Down
Loading

0 comments on commit 85eaf66

Please sign in to comment.