mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 10:59:03 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
@@ -24,19 +24,16 @@
|
||||
*/
|
||||
package com.iluwatar.factorykit.app;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import com.iluwatar.factorykit.App;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application Test Entrypoint
|
||||
*/
|
||||
/** Application Test Entrypoint */
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,20 +35,20 @@ import com.iluwatar.factorykit.WeaponType;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Factory Kit Pattern
|
||||
*/
|
||||
/** Test Factory Kit Pattern */
|
||||
class FactoryKitTest {
|
||||
|
||||
private WeaponFactory factory;
|
||||
|
||||
@BeforeEach
|
||||
void init() {
|
||||
factory = WeaponFactory.factory(builder -> {
|
||||
builder.add(WeaponType.SPEAR, Spear::new);
|
||||
builder.add(WeaponType.AXE, Axe::new);
|
||||
builder.add(WeaponType.SWORD, Sword::new);
|
||||
});
|
||||
factory =
|
||||
WeaponFactory.factory(
|
||||
builder -> {
|
||||
builder.add(WeaponType.SPEAR, Spear::new);
|
||||
builder.add(WeaponType.AXE, Axe::new);
|
||||
builder.add(WeaponType.SWORD, Sword::new);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,6 @@ class FactoryKitTest {
|
||||
verifyWeapon(weapon, Axe.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Testing {@link WeaponFactory} to produce a SWORD asserting that the Weapon is an instance of
|
||||
* {@link Sword}
|
||||
@@ -86,7 +85,7 @@ class FactoryKitTest {
|
||||
* This method asserts that the weapon object that is passed is an instance of the clazz
|
||||
*
|
||||
* @param weapon weapon object which is to be verified
|
||||
* @param clazz expected class of the weapon
|
||||
* @param clazz expected class of the weapon
|
||||
*/
|
||||
private void verifyWeapon(Weapon weapon, Class<?> clazz) {
|
||||
assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName());
|
||||
|
||||
Reference in New Issue
Block a user