Skip to content

Commit

Permalink
[Fix]: 테스트 미통과 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed Jul 2, 2024
1 parent b7d1c54 commit 95db200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.haedal.zzansuni.domain.challengegroup;

import jakarta.persistence.EntityManager;
import org.haedal.zzansuni.domain.challengegroup.challenge.Challenge;
import org.haedal.zzansuni.domain.challengegroup.image.ChallengeGroupImage;
import org.haedal.zzansuni.infrastructure.challengegroup.ChallengeGroupImageRepository;
Expand All @@ -12,17 +13,20 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

import static org.junit.jupiter.api.Assertions.assertEquals;

@SpringBootTest
@Transactional
class ChallengeGroupQueryServiceTest {
@Autowired ChallengeGroupQueryService challengeGroupQueryService;
@Autowired ChallengeGroupRepository challengeGroupRepository;
@Autowired ChallengeRepository challengeRepository;
@Autowired ChallengeGroupImageRepository challengeGroupImageRepository;
@Autowired EntityManager em;

@DisplayName("챌린지 그룹 목록 페이징이 정상적으로 동작한다.")
@Test
Expand All @@ -41,6 +45,7 @@ void getChallengeGroupsPaging() {
Pageable pageable = PageRequest.of(0, 10);
ChallengeCategory category = ChallengeCategory.ECHO;

em.clear();

// then
Page<ChallengeGroupModel.Info> challengeGroupsPaging = challengeGroupQueryService.getChallengeGroupsPaging(pageable, category);
Expand Down Expand Up @@ -75,7 +80,7 @@ void getChallengeGroupDetail() {
.build();
challengeGroupImageRepository.save(challengeGroupImage);


em.clear();
// when
ChallengeGroupModel.Detail model = challengeGroupQueryService.getChallengeGroupDetail(challengeGroup.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
@Transactional
class ChallengeGroupServiceTest {
@Autowired private ChallengeGroupService challengeGroupService;
@Autowired private ChallengeRepository challengeRepository;
@Autowired private ChallengeGroupRepository challengeGroupRepository;

@DisplayName("챌린지 그룹 생성이 정상적으로 동작한다.")
@Test
@Transactional
void createChallengeGroup() {
LocalDate startDate = LocalDate.of(2021, 1, 1);
// given
Expand Down Expand Up @@ -69,7 +69,6 @@ void createChallengeGroup() {

@DisplayName("챌린지 그룹 삭제가 정상적으로 동작한다.")
@Test
@Transactional
void deleteChallengeGroup() {
// given
ChallengeGroup challengeGroup = ChallengeGroup.builder()
Expand Down

0 comments on commit 95db200

Please sign in to comment.