Skip to content

Commit 259fbfa

Browse files
committed
Reduced static imports
1 parent 7c690a5 commit 259fbfa

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package com.thealgorithms.stacks;
22

3-
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
import static org.junit.jupiter.api.Assertions.assertFalse;
5-
import static org.junit.jupiter.api.Assertions.assertNull;
6-
import static org.junit.jupiter.api.Assertions.assertThrows;
7-
import static org.junit.jupiter.api.Assertions.assertTrue;
8-
3+
import org.junit.jupiter.api.Assertions;
94
import org.junit.jupiter.api.BeforeEach;
105
import org.junit.jupiter.api.Test;
116

@@ -22,48 +17,48 @@ public void instantiateLinkedStack() {
2217

2318
@Test
2419
void peek() {
25-
assertNull(linkedStack.peek());
20+
Assertions.assertNull(linkedStack.peek());
2621

2722
linkedStack.push(10);
2823
linkedStack.push(20);
2924
linkedStack.push(30);
3025

31-
assertEquals(30, linkedStack.peek());
26+
Assertions.assertEquals(30, linkedStack.peek());
3227
}
3328

3429
@Test
3530
void pop() {
3631
linkedStack.push(3);
3732
linkedStack.push(6);
3833

39-
assertEquals(6, linkedStack.pop());
40-
assertEquals(3, linkedStack.peek());
34+
Assertions.assertEquals(6, linkedStack.pop());
35+
Assertions.assertEquals(3, linkedStack.peek());
4136

4237
linkedStack.pop();
4338

44-
assertThrows(NoSuchElementException.class, () -> linkedStack.pop()); //Cannot pop from an empty stack
39+
Assertions.assertThrows(NoSuchElementException.class, () -> linkedStack.pop()); //Cannot pop from an empty stack
4540
}
4641

4742
@Test
4843
void push() {
4944
linkedStack.push(12);
5045

51-
assertEquals(12, linkedStack.peek());
46+
Assertions.assertEquals(12, linkedStack.peek());
5247

5348
linkedStack.push(15);
5449
linkedStack.push(17);
5550

56-
assertEquals(17, linkedStack.peek());
51+
Assertions.assertEquals(17, linkedStack.peek());
5752

5853
}
5954

6055
@Test
6156
void isEmpty() {
62-
assertTrue(linkedStack.isEmpty());
57+
Assertions.assertTrue(linkedStack.isEmpty());
6358

6459
linkedStack.push(1);
6560

66-
assertFalse(linkedStack.isEmpty());
61+
Assertions.assertFalse(linkedStack.isEmpty());
6762
}
6863

6964
@Test
@@ -73,11 +68,11 @@ void size() {
7368
linkedStack.push(3);
7469
linkedStack.push(4);
7570

76-
assertEquals(4, linkedStack.size());
71+
Assertions.assertEquals(4, linkedStack.size());
7772

7873
linkedStack.pop();
7974
linkedStack.pop();
8075

81-
assertEquals(2, linkedStack.size());
76+
Assertions.assertEquals(2, linkedStack.size());
8277
}
8378
}

0 commit comments

Comments
 (0)