-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOAuthPropertiesTest.java
45 lines (38 loc) · 1.91 KB
/
OAuthPropertiesTest.java
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
44
45
package com.debatetimer.client;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import com.debatetimer.client.oauth.OAuthProperties;
import com.debatetimer.exception.custom.DTInitializationException;
import com.debatetimer.exception.errorcode.InitializationErrorCode;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.NullAndEmptySource;
import org.junit.jupiter.params.provider.ValueSource;
class OAuthPropertiesTest {
@Nested
class Validate {
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = {"\n", "\t "})
void 클라이언트_아이디가_비어있을_경우_예외를_발생시킨다(String empty) {
assertThatThrownBy(() -> new OAuthProperties(empty, "client_secret", "grant_type"))
.isInstanceOf(DTInitializationException.class)
.hasMessage(InitializationErrorCode.OAUTH_PROPERTIES_EMPTY.getMessage());
}
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = {"\n", "\t "})
void 클라이언트_비밀키가_비어있을_경우_예외를_발생시킨다(String empty) {
assertThatThrownBy(() -> new OAuthProperties("client_id", empty, "grant_type"))
.isInstanceOf(DTInitializationException.class)
.hasMessage(InitializationErrorCode.OAUTH_PROPERTIES_EMPTY.getMessage());
}
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = {"\n", "\t "})
void 타입이_비어있을_경우_예외를_발생시킨다(String empty) {
assertThatThrownBy(() -> new OAuthProperties("client_id", "client_secret", empty))
.isInstanceOf(DTInitializationException.class)
.hasMessage(InitializationErrorCode.OAUTH_PROPERTIES_EMPTY.getMessage());
}
}
}