Skip to content

Commit

Permalink
Development: Fix flaky PostIntegrationTest (#7205)
Browse files Browse the repository at this point in the history
  • Loading branch information
laadvo authored Sep 22, 2023
1 parent 2049764 commit 08517d3
Showing 1 changed file with 6 additions and 13 deletions.
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.*;
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.*;
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.*;
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 @@ void testCreateAnnouncement() throws Exception {
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

0 comments on commit 08517d3

Please sign in to comment.