Skip to content
10 changes: 2 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
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 @@ -24,7 +24,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 @@ -23,8 +23,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 @@ -39,8 +40,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 @@ -23,7 +23,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 @@ -23,12 +23,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 @@ -41,8 +43,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 @@ -23,8 +23,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 @@ -37,8 +38,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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions update-method/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

package com.iluwatar.updatemethod;

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 @@ -23,22 +23,23 @@

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;

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

public class SkeletonTest {

private Skeleton skeleton;
private static Skeleton skeleton;

@Before
public void setup() {
@BeforeAll
public static void setup() {
skeleton = new Skeleton(1);
}

@After
public void tearDown() {
@AfterAll
public static void tearDown() {
skeleton = null;
}

Expand All @@ -47,32 +48,32 @@ public void testUpdateForPatrollingLeft() {
skeleton.patrollingLeft = true;
skeleton.setPosition(50);
skeleton.update();
Assert.assertEquals(49, skeleton.getPosition());
assertEquals(49, skeleton.getPosition());
}

@Test
public void testUpdateForPatrollingRight() {
skeleton.patrollingLeft = false;
skeleton.setPosition(50);
skeleton.update();
Assert.assertEquals(51, skeleton.getPosition());
assertEquals(51, skeleton.getPosition());
}

@Test
public void testUpdateForReverseDirectionFromLeftToRight() {
skeleton.patrollingLeft = true;
skeleton.setPosition(1);
skeleton.update();
Assert.assertEquals(0, skeleton.getPosition());
Assert.assertEquals(false, skeleton.patrollingLeft);
assertEquals(0, skeleton.getPosition());
assertEquals(false, skeleton.patrollingLeft);
}

@Test
public void testUpdateForReverseDirectionFromRightToLeft() {
skeleton.patrollingLeft = false;
skeleton.setPosition(99);
skeleton.update();
Assert.assertEquals(100, skeleton.getPosition());
Assert.assertEquals(true, skeleton.patrollingLeft);
assertEquals(100, skeleton.getPosition());
assertEquals(true, skeleton.patrollingLeft);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

public class StatueTest {

private Statue statue;
private static Statue statue;

@Before
public void setup() {
@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() {
statue.frames = 10;
statue.update();
Assert.assertEquals(11, statue.frames);
assertEquals(11, statue.frames);
}

@Test
public void testUpdateForShooting() {
statue.frames = 19;
statue.update();
Assert.assertEquals(0, statue.frames);
assertEquals(0, statue.frames);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,42 @@

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;

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

public class WorldTest {

private World world;
private static World world;

@Before
public void setup() {
@BeforeAll
public static void setup() {
world = new World();
}

@After
public void tearDown() {
@AfterAll
public static void tearDown() {
world = null;
}

@Test
public void testRun() {
world.run();
Assert.assertEquals(true, world.isRunning);
assertEquals(true, world.isRunning);
}

@Test
public void testStop() {
world.stop();
Assert.assertEquals(false, world.isRunning);
assertEquals(false, world.isRunning);
}

@Test
public void testAddEntity() {
var entity = new Skeleton(1);
world.addEntity(entity);
Assert.assertEquals(entity, world.entities.get(0));
assertEquals(entity, world.entities.get(0));
}
}