-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48c034d
commit 9ab5f06
Showing
3 changed files
with
51 additions
and
50 deletions.
There are no files selected for viewing
40 changes: 20 additions & 20 deletions
40
src/main/java/com/ray/pominowner/global/config/TokenProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
// } | ||
// | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 29 additions & 29 deletions
58
src/test/java/com/ray/pominowner/global/config/TokenProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
// } | ||
// | ||
//} |