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ä authored and GitHub committed 2025-03-29 19:34:27 +02:00
1 parent 371439aeaa
commit 0ca162a55c
1863 files changed
+14403 -17632

No files matched your search

+8
View File
@@ -34,6 +34,14 @@
</parent>
<artifactId>mute-idiom</artifactId>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
* when all we can do to handle the exception is to log it. This pattern should not be used
* everywhere. It is very important to logically handle the exceptions in a system, but some
* situations like the ones described above require this pattern, so that we don't need to repeat
*
* <pre>
* <code>
* try {
@@ -42,7 +43,9 @@ import lombok.extern.slf4j.Slf4j;
* // ignore by logging or throw error if unexpected exception occurs
* }
* </code>
* </pre> every time we need to ignore an exception.
* </pre>
*
* every time we need to ignore an exception.
*/
@Slf4j
public class App {
@@ -24,9 +24,7 @@
*/
package com.iluwatar.mute;
/**
* A runnable which may throw exception on execution.
*/
/** A runnable which may throw exception on execution. */
@FunctionalInterface
public interface CheckedRunnable {
/**
@@ -28,22 +28,19 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
/**
* A utility class that allows you to utilize mute idiom.
*/
/** A utility class that allows you to utilize mute idiom. */
@Slf4j
public final class Mute {
// The constructor is never meant to be called.
private Mute() {
}
private Mute() {}
/**
* Executes the <code>runnable</code> and throws the exception occurred within a {@link
* AssertionError}. This method should be utilized to mute the operations that are guaranteed not
* to throw an exception. For instance {@link ByteArrayOutputStream#write(byte[])} declares in
* its signature that it can throw an {@link IOException}, but in reality it cannot. This is
* because the bulk write method is not overridden in {@link ByteArrayOutputStream}.
* to throw an exception. For instance {@link ByteArrayOutputStream#write(byte[])} declares in its
* signature that it can throw an {@link IOException}, but in reality it cannot. This is because
* the bulk write method is not overridden in {@link ByteArrayOutputStream}.
*
* @param runnable a runnable that should never throw an exception on execution.
*/
@@ -30,6 +30,4 @@ import java.io.Closeable;
* Represents any resource that the application might acquire and that must be closed after it is
* utilized. Example of such resources can be a database connection, open files, sockets.
*/
public interface Resource extends Closeable {
}
public interface Resource extends Closeable {}
@@ -24,17 +24,15 @@
*/
package com.iluwatar.mute;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
* Tests that Mute idiom example runs without errors.
*/
import org.junit.jupiter.api.Test;
/** Tests that Mute idiom example runs without errors. */
class AppTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
}
@@ -24,17 +24,15 @@
*/
package com.iluwatar.mute;
import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.*;
/**
* Test for the mute-idiom pattern
*/
/** Test for the mute-idiom pattern */
class MuteTest {
private static final Logger LOGGER = LoggerFactory.getLogger(MuteTest.class);
@@ -42,7 +40,8 @@ class MuteTest {
private static final String MESSAGE = "should not occur";
@Test
void muteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
void
muteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
assertDoesNotThrow(() -> Mute.mute(this::methodNotThrowingAnyException));
}
@@ -52,7 +51,8 @@ class MuteTest {
}
@Test
void loggedMuteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
void
loggedMuteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
assertDoesNotThrow(() -> Mute.mute(this::methodNotThrowingAnyException));
}