File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
yoonexample/src/test/java/stack Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
package stack ;
2
2
3
3
import static org .assertj .core .api .Assertions .assertThat ;
4
+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
4
5
6
+ import java .util .EmptyStackException ;
5
7
import org .junit .jupiter .api .DisplayName ;
6
8
import org .junit .jupiter .api .Test ;
7
9
@@ -17,6 +19,18 @@ class StackTest {
17
19
assertThat (stack .size ()).isEqualTo (0 );
18
20
}
19
21
22
+ @ Test
23
+ @ DisplayName ("Array Stack의 EmptyStackException 테스트" )
24
+ void arrayStack의_EmptyStackException_테스트 () {
25
+ Stack <Integer > stack = new ArrayStack <>();
26
+
27
+ assertThat (stack ).isNotNull ();
28
+ assertThat (stack .isEmpty ()).isTrue ();
29
+ assertThat (stack .size ()).isEqualTo (0 );
30
+ assertThatThrownBy (stack ::pop ).isInstanceOf (EmptyStackException .class );
31
+ assertThatThrownBy (stack ::peek ).isInstanceOf (EmptyStackException .class );
32
+ }
33
+
20
34
@ Test
21
35
@ DisplayName ("Array Stack에 데이터 5개 넣기" )
22
36
void arrayStack에_데이터_5개_넣기 () {
You can’t perform that action at this time.
0 commit comments