Skip to content

Commit e85b405

Browse files
committed
test: 패스워드 인코더 유틸 테스트 추가
1 parent 33fbbea commit e85b405

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.somemore.global.util.encoder;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.DisplayName;
7+
8+
class BCryptPasswordEncoderUtilTest {
9+
10+
@Test
11+
@DisplayName("비밀번호를 성공적으로 인코딩할 수 있다")
12+
void testEncode() {
13+
// given
14+
String rawPassword = "password123";
15+
16+
// when
17+
String encodedPassword = BCryptPasswordEncoderUtil.encode(rawPassword);
18+
19+
// then
20+
assertThat(encodedPassword).isNotNull();
21+
22+
}
23+
24+
@Test
25+
@DisplayName("비밀번호를 성공적으로 매칭시킬 수 있다")
26+
void testMatches() {
27+
// given
28+
String rawPassword = "password123";
29+
30+
// when
31+
String encodedPassword = BCryptPasswordEncoderUtil.encode(rawPassword);
32+
33+
// then
34+
assertThat(BCryptPasswordEncoderUtil.matches(rawPassword, encodedPassword)).isTrue();
35+
}
36+
}

0 commit comments

Comments
 (0)