-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathEquationTest.java
More file actions
41 lines (32 loc) · 930 Bytes
/
EquationTest.java
File metadata and controls
41 lines (32 loc) · 930 Bytes
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
package study;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
public class EquationTest {
@ParameterizedTest
@ValueSource(strings = {"/", "+"})
@DisplayName("연산 기호만 반환")
void returnSymbolList(String symbol) {
//given
String input = "3 / 4 + 5";
Equation equation = new Equation(input);
//when
List<String> symbols = equation.getSymbolsList();
//then
assertThat(symbols.contains(symbol)).isTrue();
}
@ParameterizedTest
@ValueSource(ints = {3, 4})
@DisplayName("숫자들만 반환")
void returnIntList(int num) {
//given
String input = "3 + 4";
Equation equation = new Equation(input);
//when
List<Integer> ints = equation.getNumbers();
//then
assertThat(ints.contains(num)).isTrue();
}
}