File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed
src/test/java/datastructure/stack Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,15 @@ public void test() {
2121 stack .push (5 );
2222 stack .push (6 );
2323
24- assertThat (6 , is (stack .pop ()));
25- assertThat (5 , is (stack .pop ()));
26- assertThat (4 , is (stack .pop ()));
27- assertThat (3 , is (stack .pop ()));
28- assertThat (2 , is (stack .pop ()));
29- assertThat (1 , is (stack .pop ()));
30- assertThat (0 , is (stack .pop ()));
24+ assertThat (stack .pop (), is (6 ));
25+ assertThat (stack .pop (), is (5 ));
26+ assertThat (stack .pop (), is (4 ));
27+ assertThat (stack .pop (), is (3 ));
28+ assertThat (stack .pop (), is (2 ));
29+ assertThat (stack .pop (), is (1 ));
30+ assertThat (stack .pop (), is (0 ));
31+ // java.lang.ArrayIndexOutOfBoundsException: -1
32+ // assertThat(stack.pop(), is(0));
3133 }
3234
3335 public class MyStackWithArrayList <T > {
Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ public void test() {
1818 stack .push (5 );
1919 stack .push (6 );
2020
21- assertThat (6 , is ( stack .pop ()));
22- assertThat (5 , is ( stack .pop ()));
23- assertThat (4 , is ( stack .pop ()));
24- assertThat (3 , is ( stack .pop ()));
25- assertThat (2 , is ( stack .pop ()));
26- assertThat (1 , is ( stack .pop ()));
27- assertThat (0 , is ( stack .pop ()));
28-
21+ assertThat (stack .pop (), is ( 6 ));
22+ assertThat (stack .pop (), is ( 5 ));
23+ assertThat (stack .pop (), is ( 4 ));
24+ assertThat (stack .pop (), is ( 3 ));
25+ assertThat (stack .pop (), is ( 2 ));
26+ assertThat (stack .pop (), is ( 1 ));
27+ assertThat (stack .pop (), is ( 0 ));
28+
2929// java.lang.RuntimeException: Empty Stack!
3030// assertThat(0, is(stack.pop()));
3131 }
You can’t perform that action at this time.
0 commit comments