Skip to content

Commit

Permalink
fix: 잘못 커밋된 테스트 롤백
Browse files Browse the repository at this point in the history
  • Loading branch information
melonturtle committed Mar 12, 2024
1 parent c46039b commit 3b6f36b
Showing 1 changed file with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,17 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static life.offonoff.ab.domain.TestEntityUtil.TestMember;
import static life.offonoff.ab.domain.TestEntityUtil.TestTopic;
import static life.offonoff.ab.domain.topic.TopicStatus.CLOSED;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
import static life.offonoff.ab.domain.TestEntityUtil.*;
import static life.offonoff.ab.domain.topic.TopicStatus.*;
import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

@Transactional
@SpringBootTest
@Import(TestVoteConfig.TestContainerVotingTopicConfig.class)
public class VotingTopicContainerServiceIntegrationTest {
Expand All @@ -51,7 +45,7 @@ public class VotingTopicContainerServiceIntegrationTest {

@Test
@DisplayName("투표가 끝난 토픽은 status 수정 & Voting Result 매핑")
void endVote_then_status_voting_result() throws InterruptedException {
void endVote_then_status_voting_result() {
// given
LocalDateTime deadline = LocalDateTime.now();
Topic topic = TestTopic.builder()
Expand All @@ -65,19 +59,7 @@ void endVote_then_status_voting_result() throws InterruptedException {
when(container.getVotingEnded(criteria)).thenReturn(votingTopics);

// when
ExecutorService executorService = Executors.newFixedThreadPool(2);
CountDownLatch latch = new CountDownLatch(2);

executorService.execute(() -> {
votingTopicContainerService.endVote(criteria);
latch.countDown();
});

executorService.execute(() -> {
votingTopicContainerService.endVote(criteria);
latch.countDown();
});
latch.await();
votingTopicContainerService.endVote(criteria);

// then
assertThat(topic.getStatus()).isEqualTo(CLOSED);
Expand Down

0 comments on commit 3b6f36b

Please sign in to comment.