1
1
package com .thealgorithms .datastructures .stacks ;
2
2
3
3
import static org .junit .jupiter .api .Assertions .assertEquals ;
4
- import static org .junit .jupiter .api .Assertions .assertFalse ;
5
4
import static org .junit .jupiter .api .Assertions .assertThrows ;
6
5
import static org .junit .jupiter .api .Assertions .assertTrue ;
7
6
@@ -70,7 +69,7 @@ void testIsEmpty() {
70
69
NodeStack <Character > stack = new NodeStack <>();
71
70
assertTrue (stack .isEmpty (), "Newly initialized stack should be empty." );
72
71
stack .push ('A' );
73
- assertFalse (stack .isEmpty (), "Stack should not be empty after a push operation." );
72
+ org . junit . jupiter . api . Assertions . assertFalse (stack .isEmpty (), "Stack should not be empty after a push operation." );
74
73
stack .pop ();
75
74
assertTrue (stack .isEmpty (), "Stack should be empty after popping the only element." );
76
75
}
@@ -132,7 +131,7 @@ void testPeekDoesNotModifyStack() {
132
131
assertEquals (3 , peekedValue , "Peek should return top element" );
133
132
assertEquals (originalSize , intStack .size (), "Peek should not change stack size" );
134
133
assertEquals (3 , intStack .peek (), "Multiple peeks should return same value" );
135
- assertFalse (intStack .isEmpty (), "Peek should not make stack empty" );
134
+ org . junit . jupiter . api . Assertions . assertFalse (intStack .isEmpty (), "Peek should not make stack empty" );
136
135
}
137
136
138
137
@ Test
@@ -214,7 +213,7 @@ void testStateConsistencyAfterExceptions() {
214
213
215
214
// Should be able to push after exceptions
216
215
intStack .push (3 );
217
- assertFalse (intStack .isEmpty ());
216
+ org . junit . jupiter . api . Assertions . assertFalse (intStack .isEmpty ());
218
217
assertEquals (1 , intStack .size ());
219
218
assertEquals (3 , intStack .peek ());
220
219
}
@@ -224,7 +223,7 @@ void testStateConsistencyAfterExceptions() {
224
223
void testSingleElementStack () {
225
224
intStack .push (2 );
226
225
227
- assertFalse (intStack .isEmpty (), "Stack with one element should not be empty" );
226
+ org . junit . jupiter . api . Assertions . assertFalse (intStack .isEmpty (), "Stack with one element should not be empty" );
228
227
assertEquals (1 , intStack .size (), "Size should be 1" );
229
228
assertEquals (2 , intStack .peek (), "Peek should return the single element" );
230
229
assertEquals (1 , intStack .size (), "Peek should not change size" );
0 commit comments