File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
calculator/src/test/java/com/wonu606/validator Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments