Skip to content

Commit

Permalink
test: 테스트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kyY00n committed Oct 13, 2023
1 parent e8258de commit 821cd82
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class BearerTokenExtractorTest {
}

@Test
void 헤더에서_Authorization_키를_추출할_수_없으면_예외가_발생한다() {
void 토큰_형식이_유효하지_않으면_예외가_발생한다() {
// given
var 요청 = new MockHttpServletRequest();
요청.addHeader("ZipgoTestHeader", "Bearer aaaa.bbbb.cccc");
요청.addHeader("Authorization", "Bearer 내맘대로토큰");

// expect
assertThatThrownBy(() -> BearerTokenExtractor.extract(요청))
Expand All @@ -40,10 +40,10 @@ class BearerTokenExtractorTest {
}

@Test
void 토큰_형식이_유효하지_않으면_예외가_발생한다() {
void Authorization_키의_값이_Bearer_형식이_아니라면_예외가_발생한다() {
// given
var 요청 = new MockHttpServletRequest();
요청.addHeader("Authorization", "Bearer 내맘대로토큰");
요청.addHeader("Authorization", "Basic aaaaa:bbbb");

// expect
assertThatThrownBy(() -> BearerTokenExtractor.extract(요청))
Expand All @@ -52,10 +52,10 @@ class BearerTokenExtractorTest {
}

@Test
void Authorization_키의_값이_Bearer_형식이_아니라면_예외가_발생한다() {
void Bearer_null이면_예외가_발생한다() {
// given
var 요청 = new MockHttpServletRequest();
요청.addHeader("Authorization", "Basic aaaaa:bbbb");
요청.addHeader("Authorization", "Bearer null");

// expect
assertThatThrownBy(() -> BearerTokenExtractor.extract(요청))
Expand All @@ -70,7 +70,8 @@ class BearerTokenExtractorTest {

//expect
assertThatThrownBy(() -> BearerTokenExtractor.extract(요청))
.isInstanceOf(TokenMissingException.class);
.isInstanceOf(TokenMissingException.class)
.hasMessageContaining("토큰이 필요합니다.");
}

}

0 comments on commit 821cd82

Please sign in to comment.