Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ out/

!/src/main/resources/data.sql
!/src/test/resources/data-test.sql
!/src/test/resources/cast-test.sql
!/src/test/resources/category-test.sql
!/src/test/resources/country-test.sql
!/src/test/resources/director-test.sql
!/src/test/resources/genre-test.sql
!/src/test/resources/platform-test.sql
!/src/test/resources/genre-test.sql
!/src/main/resources/batch.sql
!/src/test/resources/batch-test.sql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public Member getMemberById(Long id) {
}

public void deleteAll() {
memberRepository.deleteAll();
adminRepository.deleteAll();
memberRepository.deleteAllInBatch();
adminRepository.deleteAllInBatch();
}

public boolean existsByEmail(String email) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
Expand All @@ -29,6 +30,7 @@
@Slf4j
@Component
@RequiredArgsConstructor
@Profile("!test")
public class ApiTraceAspect {

private final ObjectMapper objectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.stereotype.Component;

@Component
@Profile("local")
@Profile({"local", "test"})
public class LocalCookie implements CookieConfig {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import com.example.udtbe.domain.content.repository.ContentMetadataRepository;
import com.example.udtbe.domain.content.repository.ContentPlatformRepository;
import com.example.udtbe.domain.content.repository.ContentRepository;
import com.example.udtbe.domain.content.repository.FeedbackStatisticsRepository;
import com.example.udtbe.domain.content.repository.FeedbackStatisticsRepositoryImpl;
import com.example.udtbe.domain.content.service.FeedbackStatisticsQuery;
import com.example.udtbe.domain.member.entity.Member;
Expand Down Expand Up @@ -117,10 +116,7 @@ public class AdminServiceTest {
@Mock
private FeedbackStatisticsRepositoryImpl feedbackStatisticsRepositoryImpl;
@Mock
private FeedbackStatisticsRepository feedbackStatisticsRepository;
@Mock
private BatchJobMetricRepository batchJobMetricRepository;

@InjectMocks
private AdminService adminService;

Expand Down
34 changes: 0 additions & 34 deletions src/test/java/com/example/udtbe/common/config/TestRedisConfig.java

This file was deleted.

13 changes: 7 additions & 6 deletions src/test/java/com/example/udtbe/common/support/ApiSupport.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.udtbe.common.support;

import com.example.udtbe.common.config.TestRedisConfig;
import com.example.udtbe.common.fixture.AdminFixture;
import com.example.udtbe.common.fixture.MemberFixture;
import com.example.udtbe.domain.admin.entity.Admin;
Expand All @@ -17,16 +16,18 @@
import java.util.Date;
import java.util.Objects;
import java.util.UUID;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;

@SpringBootTest
@Import(TestRedisConfig.class)
@AutoConfigureMockMvc
@ActiveProfiles("test")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우왓 첨 보는 애노테이션입니다. 굳!

public abstract class ApiSupport extends TestContainerSupport {

protected Admin loginAdmin;
Expand All @@ -50,14 +51,14 @@ protected String toJson(Object object) throws JsonProcessingException {
return objectMapper.writeValueAsString(object);
}

@BeforeEach
@BeforeAll
void setUp() {
authQuery.deleteAll();
setUpMembers();
}

public void setUpMembers() {
if (!Objects.isNull(loginAdmin) && !Objects.isNull(loginMember) && Objects.isNull(
if (!Objects.isNull(loginAdmin) && !Objects.isNull(loginMember) && !Objects.isNull(
loginTempMember)) {
return;
}
Expand Down
Loading