From 9ab5f060f449f5755c4302f07cd917b3bfae859b Mon Sep 17 00:00:00 2001 From: junho Date: Wed, 13 Sep 2023 17:21:06 +0900 Subject: [PATCH] chore: test --- .../global/config/TokenProvider.java | 40 ++++++------- src/main/resources/application.yml | 3 +- .../global/config/TokenProviderTest.java | 58 +++++++++---------- 3 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/ray/pominowner/global/config/TokenProvider.java b/src/main/java/com/ray/pominowner/global/config/TokenProvider.java index e4623d54..0aa3de25 100644 --- a/src/main/java/com/ray/pominowner/global/config/TokenProvider.java +++ b/src/main/java/com/ray/pominowner/global/config/TokenProvider.java @@ -1,20 +1,20 @@ -package com.ray.pominowner.global.config; - -import lombok.Getter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Getter -@Component -public class TokenProvider { - - private final String businessNumberServiceKey; - private final String businessNumberHeaderAuthKey; - - public TokenProvider(@Value("${api.token.business.query:''}") String businessNumberServiceKey, - @Value("${api.token.business.header:''}") String businessNumberHeaderAuthKey) { - this.businessNumberServiceKey = businessNumberServiceKey; - this.businessNumberHeaderAuthKey = businessNumberHeaderAuthKey; - } - -} +//package com.ray.pominowner.global.config; +// +//import lombok.Getter; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.stereotype.Component; +// +//@Getter +//@Component +//public class TokenProvider { +// +// private final String businessNumberServiceKey; +// private final String businessNumberHeaderAuthKey; +// +// public TokenProvider(@Value("${api.token.business.query:''}") String businessNumberServiceKey, +// @Value("${api.token.business.header:''}") String businessNumberHeaderAuthKey) { +// this.businessNumberServiceKey = businessNumberServiceKey; +// this.businessNumberHeaderAuthKey = businessNumberHeaderAuthKey; +// } +// +//} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9b461c32..d7ae1ce8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,9 +7,10 @@ spring: activate: on-profile: prod import: sub/application-db.yml, sub/application-token.yml + --- spring: config: activate: on-profile: dev - import: dev/application-dev.yml, sub/application-token.yml + import: dev/application-dev.yml diff --git a/src/test/java/com/ray/pominowner/global/config/TokenProviderTest.java b/src/test/java/com/ray/pominowner/global/config/TokenProviderTest.java index 79d8dc48..b43b6bd7 100644 --- a/src/test/java/com/ray/pominowner/global/config/TokenProviderTest.java +++ b/src/test/java/com/ray/pominowner/global/config/TokenProviderTest.java @@ -1,29 +1,29 @@ -package com.ray.pominowner.global.config; - -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -import static org.assertj.core.api.Assertions.assertThat; - -@Slf4j -@SpringBootTest -class TokenProviderTest { - - @Autowired - private TokenProvider tokenProvider; - - @Test - @DisplayName("yml에 설정된 올바른 토큰을 가져올 수 있다.") - void successGetCorrectToken() { - String businessNumberServiceKey = tokenProvider.getBusinessNumberServiceKey(); - String businessNumberHeaderAuthKey = tokenProvider.getBusinessNumberHeaderAuthKey(); - log.info("businessNumberServiceKey: {}, businessNumberHeaderAuthKey: {}", businessNumberServiceKey, businessNumberHeaderAuthKey); - - assertThat(businessNumberServiceKey).isNotBlank().isNotEqualTo("null"); - assertThat(businessNumberHeaderAuthKey).isNotBlank().isNotEqualTo("null"); - } - -} +//package com.ray.pominowner.global.config; +// +//import lombok.extern.slf4j.Slf4j; +//import org.junit.jupiter.api.DisplayName; +//import org.junit.jupiter.api.Test; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.context.SpringBootTest; +// +//import static org.assertj.core.api.Assertions.assertThat; +// +//@Slf4j +//@SpringBootTest +//class TokenProviderTest { +// +// @Autowired +// private TokenProvider tokenProvider; +// +// @Test +// @DisplayName("yml에 설정된 올바른 토큰을 가져올 수 있다.") +// void successGetCorrectToken() { +// String businessNumberServiceKey = tokenProvider.getBusinessNumberServiceKey(); +// String businessNumberHeaderAuthKey = tokenProvider.getBusinessNumberHeaderAuthKey(); +// log.info("businessNumberServiceKey: {}, businessNumberHeaderAuthKey: {}", businessNumberServiceKey, businessNumberHeaderAuthKey); +// +// assertThat(businessNumberServiceKey).isNotBlank().isNotEqualTo("null"); +// assertThat(businessNumberHeaderAuthKey).isNotBlank().isNotEqualTo("null"); +// } +// +//}