File tree Expand file tree Collapse file tree
core-java-collections/src/test/java/com/baeldung/stack_tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212/**
1313 * Correctness tests for Stack in multi threaded environment.
1414 */
15- public class MultithreadingCorrectnessStackTests {
15+ public class MultithreadingCorrectnessStackUnitTest {
1616
1717 @ Test
18- public void test_multithreading_correctness_with_synchronized_deque () {
18+ public void givenSynchronizedDeque_whenExecutedParallel_thenWorkRight () {
1919
2020 DequeBasedSynchronizedStack <Integer > deque = new DequeBasedSynchronizedStack <>();
2121
@@ -41,7 +41,7 @@ public void test_multithreading_correctness_with_synchronized_deque() {
4141 }
4242
4343 @ Test
44- public void test_multithreading_correctness_with_concurrent_linked_queue () {
44+ public void givenConcurrentLinkedQueue_whenExecutedParallel_thenWorkRight () {
4545
4646 ConcurrentLinkedDeque <Integer > deque = new ConcurrentLinkedDeque <>();
4747
@@ -67,7 +67,7 @@ public void test_multithreading_correctness_with_concurrent_linked_queue() {
6767 }
6868
6969 @ Test
70- public void test_multithreading_correctness_with_array_deque () {
70+ public void givenArrayDeque_whenExecutedParallel_thenShouldFail () {
7171
7272 ArrayDeque <Integer > deque = new ArrayDeque <>();
7373
Original file line number Diff line number Diff line change 1717/**
1818 * These tests are to understand the Stack implementation in Java Collections.
1919 */
20- public class StackTests {
20+ public class StackUnitTest {
2121
2222 @ Test
23- public void test_basic_with_stack () {
23+ public void givenStack_whenPushPopPeek_thenWorkRight () {
2424 Stack <String > namesStack = new Stack <>();
2525
2626 namesStack .push ("Bill Gates" );
@@ -34,7 +34,7 @@ public void test_basic_with_stack() {
3434 }
3535
3636 @ Test
37- public void test_basic_with_synchronized_deque () {
37+ public void givenSynchronizedDeque_whenPushPopPeek_thenWorkRight () {
3838 DequeBasedSynchronizedStack <String > namesStack = new DequeBasedSynchronizedStack <>();
3939
4040 namesStack .push ("Bill Gates" );
@@ -48,7 +48,7 @@ public void test_basic_with_synchronized_deque() {
4848 }
4949
5050 @ Test
51- public void test_basic_with_concurrent_linked_queue () {
51+ public void givenConcurrentLinkedDeque_whenPushPopPeek_thenWorkRight () {
5252 ConcurrentLinkedDeque <String > namesStack = new ConcurrentLinkedDeque <>();
5353
5454 namesStack .push ("Bill Gates" );
You can’t perform that action at this time.
0 commit comments