Migrate to JUnit5
This commit is contained in:
@ -35,13 +35,13 @@
|
||||
<artifactId>factory-kit</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -23,7 +23,7 @@
|
||||
package com.iluwatar.factorykit.app;
|
||||
|
||||
import com.iluwatar.factorykit.App;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Application Test Entrypoint
|
||||
|
@ -22,24 +22,25 @@
|
||||
*/
|
||||
package com.iluwatar.factorykit.factorykit;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.iluwatar.factorykit.Axe;
|
||||
import com.iluwatar.factorykit.Spear;
|
||||
import com.iluwatar.factorykit.Sword;
|
||||
import com.iluwatar.factorykit.Weapon;
|
||||
import com.iluwatar.factorykit.WeaponFactory;
|
||||
import com.iluwatar.factorykit.WeaponType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
/**
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Factory Kit Pattern
|
||||
*/
|
||||
public class FactoryKitTest {
|
||||
|
||||
private WeaponFactory factory;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
factory = WeaponFactory.factory(builder -> {
|
||||
builder.add(WeaponType.SPEAR, Spear::new);
|
||||
@ -83,6 +84,6 @@ public class FactoryKitTest {
|
||||
* @param clazz expected class of the weapon
|
||||
*/
|
||||
private void verifyWeapon(Weapon weapon, Class clazz) {
|
||||
assertTrue("Weapon must be an object of: " + clazz.getName(), clazz.isInstance(weapon));
|
||||
assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user