Skip to content

Commit 119841a

Browse files
committed
test: 테스트 코드 리팩토링
1 parent ada8928 commit 119841a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

yoonexample/src/test/java/stack/InfixToPostfixTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package stack;
22

33
import static org.assertj.core.api.Assertions.assertThat;
4+
import static stack.OperatorPriority.getOperatorPriority;
45

56
import org.junit.jupiter.api.BeforeEach;
67
import org.junit.jupiter.api.DisplayName;
@@ -55,14 +56,12 @@ void setUp() {
5556
char openingParenthesis = '(';
5657
char noSign = ')';
5758

58-
assertThat(infixToPostfix.getOperatorPriority(multiplicationSign))
59-
.isEqualTo(OperatorPriority.TOP);
60-
assertThat(infixToPostfix.getOperatorPriority(divisionSign)).isEqualTo(OperatorPriority.TOP);
61-
assertThat(infixToPostfix.getOperatorPriority(plusSign)).isEqualTo(OperatorPriority.MID);
62-
assertThat(infixToPostfix.getOperatorPriority(minusSign)).isEqualTo(OperatorPriority.MID);
63-
assertThat(infixToPostfix.getOperatorPriority(openingParenthesis))
64-
.isEqualTo(OperatorPriority.BOT);
65-
assertThat(infixToPostfix.getOperatorPriority(noSign)).isEqualTo(OperatorPriority.NONE);
59+
assertThat(getOperatorPriority(multiplicationSign)).isEqualTo(OperatorPriority.TOP);
60+
assertThat(getOperatorPriority(divisionSign)).isEqualTo(OperatorPriority.TOP);
61+
assertThat(getOperatorPriority(plusSign)).isEqualTo(OperatorPriority.MID);
62+
assertThat(getOperatorPriority(minusSign)).isEqualTo(OperatorPriority.MID);
63+
assertThat(getOperatorPriority(openingParenthesis)).isEqualTo(OperatorPriority.BOT);
64+
assertThat(getOperatorPriority(noSign)).isEqualTo(OperatorPriority.NONE);
6665
}
6766

6867
@Test
@@ -71,7 +70,7 @@ void setUp() {
7170
char op1 = '*';
7271
char op2 = '+';
7372

74-
assertThat(infixToPostfix.compareOperator(op1, op2)).isEqualTo(1);
73+
assertThat(infixToPostfix.compareOperator(op1, op2)).isGreaterThan(0);
7574
}
7675

7776
@Test
@@ -89,6 +88,6 @@ void setUp() {
8988
char op1 = '(';
9089
char op2 = '+';
9190

92-
assertThat(infixToPostfix.compareOperator(op1, op2)).isEqualTo(-1);
91+
assertThat(infixToPostfix.compareOperator(op1, op2)).isLessThan(0);
9392
}
9493
}

0 commit comments

Comments
 (0)