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:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -24,9 +24,7 @@
*/
package com.iluwatar.templatemethod;
/**
* Halfling thief uses {@link StealingMethod} to steal.
*/
/** Halfling thief uses {@link StealingMethod} to steal. */
public class HalflingThief {
private StealingMethod method;
@@ -26,9 +26,7 @@ package com.iluwatar.templatemethod;
import lombok.extern.slf4j.Slf4j;
/**
* HitAndRunMethod implementation of {@link StealingMethod}.
*/
/** HitAndRunMethod implementation of {@link StealingMethod}. */
@Slf4j
public class HitAndRunMethod extends StealingMethod {
@@ -1,50 +1,46 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.templatemethod;
import lombok.extern.slf4j.Slf4j;
/**
* StealingMethod defines skeleton for the algorithm.
*/
@Slf4j
public abstract class StealingMethod {
protected abstract String pickTarget();
protected abstract void confuseTarget(String target);
protected abstract void stealTheItem(String target);
/**
* Steal.
*/
public final void steal() {
var target = pickTarget();
LOGGER.info("The target has been chosen as {}.", target);
confuseTarget(target);
stealTheItem(target);
}
}
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.templatemethod;
import lombok.extern.slf4j.Slf4j;
/** StealingMethod defines skeleton for the algorithm. */
@Slf4j
public abstract class StealingMethod {
protected abstract String pickTarget();
protected abstract void confuseTarget(String target);
protected abstract void stealTheItem(String target);
/** Steal. */
public final void steal() {
var target = pickTarget();
LOGGER.info("The target has been chosen as {}.", target);
confuseTarget(target);
stealTheItem(target);
}
}
@@ -26,9 +26,7 @@ package com.iluwatar.templatemethod;
import lombok.extern.slf4j.Slf4j;
/**
* SubtleMethod implementation of {@link StealingMethod}.
*/
/** SubtleMethod implementation of {@link StealingMethod}. */
@Slf4j
public class SubtleMethod extends StealingMethod {
@@ -24,17 +24,15 @@
*/
package com.iluwatar.templatemethod;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
* Application test
*/
import org.junit.jupiter.api.Test;
/** Application test */
class AppTest {
@Test
void shouldExecuteWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
}
@@ -26,20 +26,13 @@ package com.iluwatar.templatemethod;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.junit.jupiter.api.Test;
/**
* HalflingThiefTest
*
*/
/** HalflingThiefTest */
class HalflingThiefTest {
/**
* Verify if the thief uses the provided stealing method
*/
/** Verify if the thief uses the provided stealing method */
@Test
void testSteal() {
final var method = spy(StealingMethod.class);
@@ -48,9 +41,7 @@ class HalflingThiefTest {
verify(method).steal();
}
/**
* Verify if the thief uses the provided stealing method, and the new method after changing it
*/
/** Verify if the thief uses the provided stealing method, and the new method after changing it */
@Test
void testChangeMethod() {
final var initialMethod = spy(StealingMethod.class);
@@ -24,23 +24,16 @@
*/
package com.iluwatar.templatemethod;
/**
* HitAndRunMethodTest
*
*/
/** HitAndRunMethodTest */
class HitAndRunMethodTest extends StealingMethodTest<HitAndRunMethod> {
/**
* Create a new test for the {@link HitAndRunMethod}
*/
/** Create a new test for the {@link HitAndRunMethod} */
public HitAndRunMethodTest() {
super(
new HitAndRunMethod(),
"old goblin woman",
"The target has been chosen as old goblin woman.",
"Approach the old goblin woman from behind.",
"Grab the handbag and run away fast!"
);
"Grab the handbag and run away fast!");
}
}
}
@@ -56,42 +56,36 @@ public abstract class StealingMethodTest<M extends StealingMethod> {
appender.stop();
}
/**
* The tested stealing method
*/
/** The tested stealing method */
private final M method;
/**
* The expected target
*/
/** The expected target */
private final String expectedTarget;
/**
* The expected target picking result
*/
/** The expected target picking result */
private final String expectedTargetResult;
/**
* The expected confusion method
*/
/** The expected confusion method */
private final String expectedConfuseMethod;
/**
* The expected stealing method
*/
/** The expected stealing method */
private final String expectedStealMethod;
/**
* Create a new test for the given stealing method, together with the expected results
*
* @param method The tested stealing method
* @param expectedTarget The expected target name
* @param expectedTargetResult The expected target picking result
* @param method The tested stealing method
* @param expectedTarget The expected target name
* @param expectedTargetResult The expected target picking result
* @param expectedConfuseMethod The expected confusion method
* @param expectedStealMethod The expected stealing method
* @param expectedStealMethod The expected stealing method
*/
public StealingMethodTest(final M method, String expectedTarget, final String expectedTargetResult,
final String expectedConfuseMethod, final String expectedStealMethod) {
public StealingMethodTest(
final M method,
String expectedTarget,
final String expectedTargetResult,
final String expectedConfuseMethod,
final String expectedStealMethod) {
this.method = method;
this.expectedTarget = expectedTarget;
@@ -100,17 +94,13 @@ public abstract class StealingMethodTest<M extends StealingMethod> {
this.expectedStealMethod = expectedStealMethod;
}
/**
* Verify if the thief picks the correct target
*/
/** Verify if the thief picks the correct target */
@Test
void testPickTarget() {
assertEquals(expectedTarget, this.method.pickTarget());
}
/**
* Verify if the target confusing step goes as planned
*/
/** Verify if the target confusing step goes as planned */
@Test
void testConfuseTarget() {
assertEquals(0, appender.getLogSize());
@@ -120,9 +110,7 @@ public abstract class StealingMethodTest<M extends StealingMethod> {
assertEquals(1, appender.getLogSize());
}
/**
* Verify if the stealing step goes as planned
*/
/** Verify if the stealing step goes as planned */
@Test
void testStealTheItem() {
assertEquals(0, appender.getLogSize());
@@ -132,9 +120,7 @@ public abstract class StealingMethodTest<M extends StealingMethod> {
assertEquals(1, appender.getLogSize());
}
/**
* Verify if the complete steal process goes as planned
*/
/** Verify if the complete steal process goes as planned */
@Test
void testSteal() {
this.method.steal();
@@ -24,23 +24,16 @@
*/
package com.iluwatar.templatemethod;
/**
* SubtleMethodTest
*
*/
/** SubtleMethodTest */
class SubtleMethodTest extends StealingMethodTest<SubtleMethod> {
/**
* Create a new test for the {@link SubtleMethod}
*/
/** Create a new test for the {@link SubtleMethod} */
public SubtleMethodTest() {
super(
new SubtleMethod(),
"shop keeper",
"The target has been chosen as shop keeper.",
"Approach the shop keeper with tears running and hug him!",
"While in close contact grab the shop keeper's wallet."
);
"While in close contact grab the shop keeper's wallet.");
}
}
}