Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Updated saga to JUnit 5
  • Loading branch information
charlesfinley committed Oct 2, 2020
commit bac42eef0cf43281fbc8b2a039e4d3cb055c2200
5 changes: 0 additions & 5 deletions saga/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
package com.iluwatar.saga.choreography;

import com.iluwatar.saga.orchestration.SagaApplication;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
*/
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
Expand All @@ -38,8 +39,8 @@ public void executeTest() {
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(badOrderSaga.getResult(), Saga.SagaResult.ROLLBACKED);
assertEquals(goodOrderSaga.getResult(), Saga.SagaResult.FINISHED);
}

private static Saga newSaga(Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
package com.iluwatar.saga.orchestration;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* empty test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
*/
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
Expand All @@ -40,8 +42,8 @@ public class SagaOrchestratorInternallyTest {
public void executeTest() {
var sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery());
var result = sagaOrchestrator.execute(1);
Assert.assertEquals(result, Result.ROLLBACK);
Assert.assertArrayEquals(
assertEquals(result, Result.ROLLBACK);
assertArrayEquals(
records.toArray(new String[]{}),
new String[]{"+1", "+2", "+3", "+4", "-4", "-3", "-2", "-1"});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
*/
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
Expand All @@ -36,8 +37,8 @@ public void execute() {
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(badOrder, Saga.Result.ROLLBACK);
assertEquals(crashedOrder, Saga.Result.CRASHED);
}

private static Saga newSaga() {
Expand Down