Skip to content

Commit 8f347a2

Browse files
committed
test: 중위 연산식 유효 검사 클래스 테스트 작성 및 통과
1 parent 72db880 commit 8f347a2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.wonu606.validator;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import com.wonu606.calculator.validator.InfixValidator;
6+
import com.wonu606.calculator.validator.Validator;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class InfixValidatorTest {
10+
11+
@Test
12+
void testNotInfix() {
13+
// given
14+
Validator validator = new InfixValidator();
15+
16+
// when
17+
String expression = "+ 1 3";
18+
19+
// then
20+
assertThat(validator.isValid(expression)).isFalse();
21+
}
22+
23+
@Test
24+
void testInfix() {
25+
// given
26+
Validator validator = new InfixValidator();
27+
28+
// when
29+
String expression = "1 + 3 + 2 * -3 / -123";
30+
31+
// then
32+
assertThat(validator.isValid(expression)).isTrue();
33+
}
34+
}

0 commit comments

Comments
 (0)