Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Fix flaky PostIntegrationTest #7205

Merged
merged 8 commits into from
Sep 22, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import java.util.*;
import java.util.stream.Collectors;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.mail.internet.MimeMessage;
import javax.validation.*;

Check warning on line 11 in src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java

View check run for this annotation

Teamscale / teamscale-findings

src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java#L11

Star import of `javax.validation.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=development%2Ffix-PostIntegrationTest%3AHEAD&id=D49B440506F17B7C39C9D1832812BB14
import javax.validation.constraints.NotNull;

import org.junit.jupiter.api.AfterEach;
Expand All @@ -25,18 +23,12 @@
import org.springframework.util.MultiValueMap;

import de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest;
import de.tum.in.www1.artemis.domain.Course;
import de.tum.in.www1.artemis.domain.Exercise;
import de.tum.in.www1.artemis.domain.Lecture;
import de.tum.in.www1.artemis.domain.User;
import de.tum.in.www1.artemis.domain.*;

Check warning on line 26 in src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java

View check run for this annotation

Teamscale / teamscale-findings

src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java#L26

Star import of `de.tum.in.www1.artemis.domain.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=development%2Ffix-PostIntegrationTest%3AHEAD&id=D339B6FE5BD2B4A6D0ADE761A5B7D19E
import de.tum.in.www1.artemis.domain.enumeration.CourseInformationSharingConfiguration;
import de.tum.in.www1.artemis.domain.enumeration.DisplayPriority;
import de.tum.in.www1.artemis.domain.enumeration.SortingOrder;
import de.tum.in.www1.artemis.domain.exam.Exam;
import de.tum.in.www1.artemis.domain.metis.CourseWideContext;
import de.tum.in.www1.artemis.domain.metis.Post;
import de.tum.in.www1.artemis.domain.metis.PostSortCriterion;
import de.tum.in.www1.artemis.domain.metis.UserRole;
import de.tum.in.www1.artemis.domain.metis.*;

Check warning on line 31 in src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java

View check run for this annotation

Teamscale / teamscale-findings

src/test/java/de/tum/in/www1/artemis/metis/PostIntegrationTest.java#L31

Star import of `de.tum.in.www1.artemis.domain.metis.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=development%2Ffix-PostIntegrationTest%3AHEAD&id=D9DA075E09189322317C865247227747
import de.tum.in.www1.artemis.domain.plagiarism.PlagiarismCase;
import de.tum.in.www1.artemis.exam.ExamUtilService;
import de.tum.in.www1.artemis.post.ConversationUtilService;
Expand Down Expand Up @@ -303,9 +295,10 @@
postToSave.setDisplayPriority(DisplayPriority.PINNED);
checkCreatedPost(postToSave, createdPost);

List<Post> updatedCourseWidePosts = postRepository.findPosts(postContextFilter, null, false, null).stream().filter(post -> post.getCourseWideContext() != null).toList();
postRepository.findPosts(postContextFilter, null, false, null).stream().filter(post -> post.getCourseWideContext() != null).toList();
assertThat(postRepository.findPosts(postContextFilter, null, false, null)).hasSize(numberOfPostsBefore + 1);
verify(groupNotificationService).notifyAllGroupsAboutNewAnnouncement(createdPost, course);
verify(javaMailSender, timeout(4000).times(4)).send(any(MimeMessage.class));
}

@Test
Expand Down
Loading