-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAes256CipherTest.java
More file actions
43 lines (33 loc) · 1.15 KB
/
Aes256CipherTest.java
File metadata and controls
43 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.listywave.common.encrypt;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
import com.listywave.common.IntegrationTest;
import org.junit.jupiter.api.Test;
class Aes256CipherTest extends IntegrationTest {
@Test
void 암호화를_한다() {
// given
String plainText = "plain";
// when
String result = aes256Cipher.encrypt(plainText);
String result2 = aes256Cipher.encrypt(plainText);
String result3 = aes256Cipher.encrypt(plainText);
// then
assertAll(
() -> assertThat(result).isEqualTo(result2).isEqualTo(result3),
() -> assertThat(plainText).isNotEqualTo(result)
.isNotEqualTo(result2)
.isNotEqualTo(result3)
);
}
@Test
void 복호화를_한다() {
// given
String plainText = "plain";
String encrypted = aes256Cipher.encrypt(plainText);
// when
String decrypted = aes256Cipher.decrypt(encrypted);
// then
assertThat(plainText).isEqualTo(decrypted);
}
}