Repository: iluwatar/java-design-patterns
Issue: Use the same JUnit version everywhere
Labels: info: help wanted
epic: build issue
epic: dependencies
type: refactoring

At the moment there are some modules that are still using JUnit 4. Most of the codebase uses JUnit 5, but even with that there are different versions. For example `unit-of-work` and `partial-response` declare their own versions.

In this ticket let's try to apply the same version of JUnit 5 everywhere upgrading from JUnit 4 where needed.


## This issue has been partially addressed using #1542 and #1668

Tests from two modules [**serverless**](https://github.com/iluwatar/java-design-patterns/tree/master/serverless) and [**naked-objects**](https://github.com/iluwatar/java-design-patterns/tree/master/naked-objects) are not being executed.

Respective issues have been opened for resolving the tests in favour of these two modules.
- [x] #1667 against [**serverless**](https://github.com/iluwatar/java-design-patterns/tree/master/serverless)
- [ ] #1669 against [**naked-objects**](https://github.com/iluwatar/java-design-patterns/tree/master/naked-objects)

Resolving these two issues should close this [current issue](https://github.com/iluwatar/java-design-patterns/issues/1500)

Issue comments:
I'd like to take this issue. Thank you in advance.
Yes @ToxicDreamz, go ahead ☺️ 
Half way through upgrading, one test case seems to be causing an issue, within the **Serverless** module, in specific the **`SavePersonApiHandlerTest#handleRequestSavePersonException()`** method. I do not have any knowledge of the AWS library, which is why I chose not to mess around with it. 

Initially the DynamoDBMapper was being Mocked with Mockito, and was causing issues once the tests were upgraded to JUnit 5 stating that the class could not be mocked, but as stated in the official Mockito guidelines, a type **should not be mocked if it doesn't belong to you**. See attached link below for details.

https://github.com/mockito/mockito/wiki/How-to-write-good-tests#dont-mock-a-type-you-dont-own

### Suggestion.
A new issue should be opened to address that certain test case, as of now the test case is commented out and marked with a **_TODO_**


### Displayed Error

```
> 
> Caused by: com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
> 	at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:371)
> 	at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:337)
> 	at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
> 	at com.iluwatar.serverless.baas.api.SavePersonApiHandlerTest.<clinit>(SavePersonApiHandlerTest.java:58)
> 	... 53 more
```

Error after supplying region`

```
> com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain
> 
> 	at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:131)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1164)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:762)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:724)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
> 	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
> 	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
> 	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:3082)
> 	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:3058)
> 	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.executePutItem(AmazonDynamoDBClient.java:2119)
> 	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.putItem(AmazonDynamoDBClient.java:2094)
> 	at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper$SaveObjectHandler.doPutItem(DynamoDBMapper.java:883)
> 	at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper$1.executeLowLevelRequest(DynamoDBMapper.java:536)
> 	at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper$SaveObjectHandler.execute(DynamoDBMapper.java:733)
> 	at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.save(DynamoDBMapper.java:623)
> 	at com.amazonaws.services.dynamodbv2.datamodeling.AbstractDynamoDBMapper.save(AbstractDynamoDBMapper.java:123)
> 	at com.iluwatar.serverless.baas.api.SavePersonApiHandler.handleRequest(SavePersonApiHandler.java:50)
> 	at com.iluwatar.serverless.baas.api.SavePersonApiHandlerTest.handleRequestSavePersonSuccessful(SavePersonApiHandlerTest.java:76)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> 	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
> 	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124)
> 	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
> 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> 	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
> 	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> 	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> 	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> 	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> 	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> 	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> 	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> 	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
> 	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
> 	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
> 	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
> 	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
> 	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> 	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> 	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> 	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

```


Overall the serverless module needs to be looked at, more tests are causing the same issues due to them not being able to be mocked.
@ToxicDreamz FYI: I created #1505 which removes the dependency of `subclass-sandbox` to Rule, which is a JUnit 4 only feature.
@stefanbirkner Okay, thank you for the heads up. I'll wait for @iluwatar to merge that PR, until I continue with that module.
It's merged now
Using JUnit 5 in Trampoline module. PR #1529 created.
I want to work on this issue if its is still unassigned .
Ok @sgarg5794 
I'm working on updating all the modules to JUnit5 right now. @ohbus 
Sure @charlesfinley you're good to go!
> Sure @charlesfinley you're good to go!

Sorry I opened a new PR for this - #1668 
@charlesfinley no need to be sorry for 😄  It is easier for us to review code in smaller chunks and this helps a lot 💯 

Thank you so much for your help!
> @charlesfinley no need to be sorry for 😄 It is easier for us to review code in smaller chunks and this helps a lot 💯
> 
> Thank you so much for your help!

This issue should probably be closed since the PR was merged and we have 2 new issues identifying the only modules lacking JUnit5. 
@charlesfinley great work!

We will close this issue for sure.
This issue has been partially addressed using #1542 and #1668 thanks to @charlesfinley 

Tests from two modules [**serverless**](https://github.com/iluwatar/java-design-patterns/tree/master/serverless) and [**naked-objects**](https://github.com/iluwatar/java-design-patterns/tree/master/naked-objects) are not being executed.

Respective issues have been opened for resolving the tests in favour of these two modules.
- [ ] #1667
- [ ] #1669

Resolving these two issues should close this [current issue](https://github.com/iluwatar/java-design-patterns/issues/1500)
@iluwatar let me know how can I help with this, I am confused about the status of the what has been resolved and what is pending.
Thanks for asking @anuragagarwal561994. I think the only remaining issue is that naked objects pattern still uses JUnit 4. Resolving this is covered by issues https://github.com/iluwatar/java-design-patterns/issues/1669 and https://github.com/iluwatar/java-design-patterns/issues/1683. I think we should close this task.

Pull request review comments:
Could you please describe this change a bit, why is it needed? This particular snippet is also part of the pattern's `README.md` (which is rendered on the https://java-design-patterns.com web site) so all the changes should be reflected there.
@charlesfinley can you please clarify on this part as why we modified this access specifier to `private`

We would love to merge the code to master.
Will update soon with explanation. Sorry for the delay. 
@iluwatar @ohbus - Reverted the change. It's no longer required. 
Please add an extra line here
add an empty line here
```suggestion
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
```
Fixed the star import. 
You want an empty line after the method declaration and before the assertion? 
Yes an empty line at the end of the file.
Ah, duh. I need coffee. Updated!
Done

Patch that resolved the issue:
diff --git a/pom.xml b/pom.xml
index 48fa6fdcf801..8b00646c5e2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,8 +41,8 @@
         <spring-data.version>2.0.14.RELEASE</spring-data.version>
         <h2.version>1.4.190</h2.version>
         <junit.version>4.12</junit.version>
-        <junit-jupiter.version>5.5.2</junit-jupiter.version>
-        <junit-vintage.version>${junit.version}.2</junit-vintage.version>
+        <junit-jupiter.version>5.7.1</junit-jupiter.version>
+        <junit-vintage.version>${junit-jupiter.version}</junit-vintage.version>
         <sping-test-junit5.version>1.0.2</sping-test-junit5.version>
         <compiler.version>3.8.1</compiler.version>
         <jacoco.version>0.8.6</jacoco.version>
@@ -274,12 +274,6 @@
                 <artifactId>camel-stream</artifactId>
                 <version>${camel.version}</version>
             </dependency>
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-                <version>${junit.version}</version>
-                <scope>test</scope>
-            </dependency>
             <dependency>
                 <groupId>org.junit.jupiter</groupId>
                 <artifactId>junit-jupiter-api</artifactId>
diff --git a/saga/pom.xml b/saga/pom.xml
index 07d327885258..80eb70f752ad 100644
--- a/saga/pom.xml
+++ b/saga/pom.xml
@@ -35,11 +35,6 @@
 
     <artifactId>saga</artifactId>
     <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-engine</artifactId>
diff --git a/trampoline/src/main/java/com/iluwatar/trampoline/Trampoline.java b/trampoline/src/main/java/com/iluwatar/trampoline/Trampoline.java
index b28a148039cb..1d2ea91d31a6 100644
--- a/trampoline/src/main/java/com/iluwatar/trampoline/Trampoline.java
+++ b/trampoline/src/main/java/com/iluwatar/trampoline/Trampoline.java
@@ -98,7 +98,7 @@ public T get() {
         return trampoline(this);
       }
 
-      private T trampoline(final Trampoline<T> trampoline) {
+      T trampoline(final Trampoline<T> trampoline) {
         return Stream.iterate(trampoline, Trampoline::jump)
             .filter(Trampoline::complete)
             .findFirst()
diff --git a/update-method/pom.xml b/update-method/pom.xml
index b49ab3c070b2..b70520a99898 100644
--- a/update-method/pom.xml
+++ b/update-method/pom.xml
@@ -35,10 +35,6 @@
 
     <artifactId>update-method</artifactId>
     <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-engine</artifactId>


Test patch:
diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java
index 52b407b57294..67ac0f2fae1d 100644
--- a/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java
+++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java
@@ -23,18 +23,19 @@
 
 package com.iluwatar.saga.choreography;
 
-import com.iluwatar.saga.orchestration.SagaApplication;
-import org.junit.Test;
-
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
+import com.iluwatar.saga.orchestration.SagaApplication;
+import org.junit.jupiter.api.Test;
+
 
 /***
  * empty test
  */
-public class SagaApplicationTest {
+class SagaApplicationTest {
+
   @Test
-  public void shouldExecuteWithoutException() {
+  void shouldExecuteWithoutException() {
     assertDoesNotThrow(() -> SagaApplication.main(new String[]{}));
   }
-}
\ No newline at end of file
+}
diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java
index b1ddcf13f465..749a66ac5617 100644
--- a/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java
+++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java
@@ -23,24 +23,25 @@
 
 package com.iluwatar.saga.choreography;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * test to check choreography saga
  */
-public class SagaChoreographyTest {
+class SagaChoreographyTest {
 
 
   @Test
-  public void executeTest() {
+  void executeTest() {
     var sd = serviceDiscovery();
     var service = sd.findAny();
     var badOrderSaga = service.execute(newSaga("bad_order"));
     var goodOrderSaga = service.execute(newSaga("good_order"));
 
-    Assert.assertEquals(badOrderSaga.getResult(), Saga.SagaResult.ROLLBACKED);
-    Assert.assertEquals(goodOrderSaga.getResult(), Saga.SagaResult.FINISHED);
+    assertEquals(Saga.SagaResult.ROLLBACKED, badOrderSaga.getResult());
+    assertEquals(Saga.SagaResult.FINISHED, goodOrderSaga.getResult());
   }
 
   private static Saga newSaga(Object value) {
diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java
index 1ebb9de4428a..29a2f7eb60a8 100644
--- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java
+++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java
@@ -23,15 +23,15 @@
 
 package com.iluwatar.saga.orchestration;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * empty test
  */
-public class SagaApplicationTest {
+class SagaApplicationTest {
 
   @Test
-  public void mainTest() {
+  void mainTest() {
     SagaApplication.main(new String[]{});
   }
-}
\ No newline at end of file
+}
diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java
index 6a1a257df716..23635d1e6665 100644
--- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java
+++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java
@@ -23,28 +23,30 @@
 
 package com.iluwatar.saga.orchestration;
 
+import org.junit.jupiter.api.Test;
+
 import static com.iluwatar.saga.orchestration.Saga.Result;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
 
 /**
  * test to test orchestration logic
  */
-public class SagaOrchestratorInternallyTest {
+class SagaOrchestratorInternallyTest {
 
   private final List<String> records = new ArrayList<>();
 
   @Test
-  public void executeTest() {
+  void executeTest() {
     var sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery());
     var result = sagaOrchestrator.execute(1);
-    Assert.assertEquals(result, Result.ROLLBACK);
-    Assert.assertArrayEquals(
-        records.toArray(new String[]{}),
-        new String[]{"+1", "+2", "+3", "+4", "-4", "-3", "-2", "-1"});
+    assertEquals(Result.ROLLBACK, result);
+    assertArrayEquals(
+            new String[]{"+1", "+2", "+3", "+4", "-4", "-3", "-2", "-1"},
+            records.toArray(new String[]{}));
   }
 
   private static Saga newSaga() {
diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java
index 7dd4c318059a..2a1da99810e4 100644
--- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java
+++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java
@@ -23,22 +23,23 @@
 
 package com.iluwatar.saga.orchestration;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * test to check general logic
  */
-public class SagaOrchestratorTest {
+class SagaOrchestratorTest {
 
   @Test
-  public void execute() {
+  void execute() {
     SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery());
     Saga.Result badOrder = sagaOrchestrator.execute("bad_order");
     Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order");
 
-    Assert.assertEquals(badOrder, Saga.Result.ROLLBACK);
-    Assert.assertEquals(crashedOrder, Saga.Result.CRASHED);
+    assertEquals(Saga.Result.ROLLBACK, badOrder);
+    assertEquals(Saga.Result.CRASHED, crashedOrder);
   }
 
   private static Saga newSaga() {
diff --git a/update-method/src/test/java/com/iluwatar/updatemethod/AppTest.java b/update-method/src/test/java/com/iluwatar/updatemethod/AppTest.java
index 6158e74912bc..9c5c2a1e2bb2 100644
--- a/update-method/src/test/java/com/iluwatar/updatemethod/AppTest.java
+++ b/update-method/src/test/java/com/iluwatar/updatemethod/AppTest.java
@@ -23,14 +23,14 @@
 
 package com.iluwatar.updatemethod;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
-public class AppTest {
+class AppTest {
 
   @Test
-  public void shouldExecuteApplicationWithoutException() {
+  void shouldExecuteApplicationWithoutException() {
     assertDoesNotThrow(() -> App.main(new String[]{}));
   }
 }
diff --git a/update-method/src/test/java/com/iluwatar/updatemethod/SkeletonTest.java b/update-method/src/test/java/com/iluwatar/updatemethod/SkeletonTest.java
index 2562180b8f56..a30dd26cb712 100644
--- a/update-method/src/test/java/com/iluwatar/updatemethod/SkeletonTest.java
+++ b/update-method/src/test/java/com/iluwatar/updatemethod/SkeletonTest.java
@@ -23,56 +23,60 @@
 
 package com.iluwatar.updatemethod;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-public class SkeletonTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-  private Skeleton skeleton;
 
-  @Before
-  public void setup() {
+class SkeletonTest {
+
+  private static Skeleton skeleton;
+
+  @BeforeAll
+  public static void setup() {
     skeleton = new Skeleton(1);
   }
 
-  @After
-  public void tearDown() {
+  @AfterAll
+  public static void tearDown() {
     skeleton = null;
   }
 
   @Test
-  public void testUpdateForPatrollingLeft() {
+  void testUpdateForPatrollingLeft() {
     skeleton.patrollingLeft = true;
     skeleton.setPosition(50);
     skeleton.update();
-    Assert.assertEquals(49, skeleton.getPosition());
+    assertEquals(49, skeleton.getPosition());
   }
 
   @Test
-  public void testUpdateForPatrollingRight() {
+  void testUpdateForPatrollingRight() {
     skeleton.patrollingLeft = false;
     skeleton.setPosition(50);
     skeleton.update();
-    Assert.assertEquals(51, skeleton.getPosition());
+    assertEquals(51, skeleton.getPosition());
   }
 
   @Test
-  public void testUpdateForReverseDirectionFromLeftToRight() {
+  void testUpdateForReverseDirectionFromLeftToRight() {
     skeleton.patrollingLeft = true;
     skeleton.setPosition(1);
     skeleton.update();
-    Assert.assertEquals(0, skeleton.getPosition());
-    Assert.assertEquals(false, skeleton.patrollingLeft);
+    assertEquals(0, skeleton.getPosition());
+    assertFalse(skeleton.patrollingLeft);
   }
 
   @Test
-  public void testUpdateForReverseDirectionFromRightToLeft() {
+  void testUpdateForReverseDirectionFromRightToLeft() {
     skeleton.patrollingLeft = false;
     skeleton.setPosition(99);
     skeleton.update();
-    Assert.assertEquals(100, skeleton.getPosition());
-    Assert.assertEquals(true, skeleton.patrollingLeft);
+    assertEquals(100, skeleton.getPosition());
+    assertTrue(skeleton.patrollingLeft);
   }
 }
diff --git a/update-method/src/test/java/com/iluwatar/updatemethod/StatueTest.java b/update-method/src/test/java/com/iluwatar/updatemethod/StatueTest.java
index eea6bbeb1278..3b28ffd5d3cb 100644
--- a/update-method/src/test/java/com/iluwatar/updatemethod/StatueTest.java
+++ b/update-method/src/test/java/com/iluwatar/updatemethod/StatueTest.java
@@ -23,36 +23,37 @@
 
 package com.iluwatar.updatemethod;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-public class StatueTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-  private Statue statue;
+class StatueTest {
 
-  @Before
-  public void setup() {
+  private static Statue statue;
+
+  @BeforeAll
+  public static void setup() {
     statue = new Statue(1, 20);
   }
 
-  @After
-  public void tearDown() {
+  @AfterAll
+  public static void tearDown() {
     statue = null;
   }
 
   @Test
-  public void testUpdateForPendingShoot() {
+  void testUpdateForPendingShoot() {
     statue.frames = 10;
     statue.update();
-    Assert.assertEquals(11, statue.frames);
+    assertEquals(11, statue.frames);
   }
 
   @Test
-  public void testUpdateForShooting() {
+  void testUpdateForShooting() {
     statue.frames = 19;
     statue.update();
-    Assert.assertEquals(0, statue.frames);
+    assertEquals(0, statue.frames);
   }
 }
diff --git a/update-method/src/test/java/com/iluwatar/updatemethod/WorldTest.java b/update-method/src/test/java/com/iluwatar/updatemethod/WorldTest.java
index b8d95f140705..843c4a654d21 100644
--- a/update-method/src/test/java/com/iluwatar/updatemethod/WorldTest.java
+++ b/update-method/src/test/java/com/iluwatar/updatemethod/WorldTest.java
@@ -23,41 +23,44 @@
 
 package com.iluwatar.updatemethod;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-public class WorldTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-  private World world;
+class WorldTest {
 
-  @Before
-  public void setup() {
+  private static World world;
+
+  @BeforeAll
+  public static void setup() {
     world = new World();
   }
 
-  @After
-  public void tearDown() {
+  @AfterAll
+  public static void tearDown() {
     world = null;
   }
 
   @Test
-  public void testRun() {
+  void testRun() {
     world.run();
-    Assert.assertEquals(true, world.isRunning);
+    assertTrue(world.isRunning);
   }
 
   @Test
-  public void testStop() {
+  void testStop() {
     world.stop();
-    Assert.assertEquals(false, world.isRunning);
+    assertFalse(world.isRunning);
   }
 
   @Test
-  public void testAddEntity() {
+  void testAddEntity() {
     var entity = new Skeleton(1);
     world.addEntity(entity);
-    Assert.assertEquals(entity, world.entities.get(0));
+    assertEquals(entity, world.entities.get(0));
   }
 }