Skip to content

Commit

Permalink
[fix] 테스트 컴파일 에러 해결 (#490)
Browse files Browse the repository at this point in the history
* feat: CookieDomainProvider 인터페이스 선언 및 구현클래스 추가

- 프로파일 환경별 도메인 이름을 제공하는 인터페이스 추가

* fix: 테스트 컴파일 에러 해결
  • Loading branch information
yonghwankim-dev authored Oct 8, 2024
1 parent 89cf118 commit 6c7b8f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/test/java/co/fineants/AbstractContainerBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import co.fineants.api.domain.watchlist.domain.entity.WatchStock;
import co.fineants.api.global.errors.errorcode.RoleErrorCode;
import co.fineants.api.global.errors.exception.FineAntsException;
import co.fineants.api.global.security.factory.CookieDomainProvider;
import co.fineants.api.global.security.factory.TokenFactory;
import co.fineants.api.global.security.oauth.dto.MemberAuthentication;
import co.fineants.api.global.security.oauth.dto.Token;
Expand Down Expand Up @@ -105,6 +106,9 @@ public abstract class AbstractContainerBaseTest {
@Autowired
private PortfolioProperties properties;

@Autowired
private CookieDomainProvider cookieDomainProvider;

@DynamicPropertySource
public static void overrideProps(DynamicPropertyRegistry registry) {
// redis property config
Expand Down Expand Up @@ -369,7 +373,7 @@ protected List<StockDividend> createStockDividendThisYearWith(Stock stock) {
}

protected Cookie[] createTokenCookies() {
TokenFactory tokenFactory = new TokenFactory();
TokenFactory tokenFactory = new TokenFactory(cookieDomainProvider);
Token token = Token.create("accessToken", "refreshToken");
ResponseCookie accessTokenCookie = tokenFactory.createAccessTokenCookie(token);
ResponseCookie refreshTokenCookie = tokenFactory.createRefreshTokenCookie(token);
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/co/fineants/api/docs/RestDocsSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import co.fineants.api.domain.stock_target_price.domain.entity.TargetPriceNotification;
import co.fineants.api.domain.watchlist.domain.entity.WatchList;
import co.fineants.api.global.config.JacksonConfig;
import co.fineants.api.global.security.factory.LocalCookieDomainProvider;
import co.fineants.api.global.security.factory.TokenFactory;
import co.fineants.api.global.security.oauth.dto.MemberAuthentication;
import co.fineants.api.global.security.oauth.dto.Token;
Expand Down Expand Up @@ -233,7 +234,7 @@ protected MultipartFile createMockMultipartFile() {
}

protected Cookie[] createTokenCookies() {
TokenFactory tokenFactory = new TokenFactory();
TokenFactory tokenFactory = new TokenFactory(new LocalCookieDomainProvider());
Token token = Token.create("accessToken", "refreshToken");
ResponseCookie accessTokenCookie = tokenFactory.createAccessTokenCookie(token);
ResponseCookie refreshTokenCookie = tokenFactory.createRefreshTokenCookie(token);
Expand Down

0 comments on commit 6c7b8f5

Please sign in to comment.