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
@@ -30,20 +30,18 @@ import java.util.Scanner;
import lombok.extern.slf4j.Slf4j;
/**
* The Execute Around idiom specifies executable code before and after a method. Typically,
* the idiom is used when the API has methods to be executed in pairs, such as resource
* The Execute Around idiom specifies executable code before and after a method. Typically, the
* idiom is used when the API has methods to be executed in pairs, such as resource
* allocation/deallocation or lock acquisition/release.
*
* <p>In this example, we have {@link SimpleFileWriter} class that opens and closes the file for
* the user. The user specifies only what to do with the file by providing the {@link
* FileWriterAction} implementation.
* <p>In this example, we have {@link SimpleFileWriter} class that opens and closes the file for the
* user. The user specifies only what to do with the file by providing the {@link FileWriterAction}
* implementation.
*/
@Slf4j
public class App {
/**
* Program entry point.
*/
/** Program entry point. */
public static void main(String[] args) throws IOException {
// create the file writer and execute the custom action
@@ -27,12 +27,9 @@ package com.iluwatar.execute.around;
import java.io.FileWriter;
import java.io.IOException;
/**
* Interface for specifying what to do with the file resource.
*/
/** Interface for specifying what to do with the file resource. */
@FunctionalInterface
public interface FileWriterAction {
void writeFile(FileWriter writer) throws IOException;
}
@@ -35,9 +35,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SimpleFileWriter {
/**
* Constructor.
*/
/** Constructor. */
public SimpleFileWriter(String filename, FileWriterAction action) throws IOException {
LOGGER.info("Opening the file");
try (var writer = new FileWriter(filename)) {
@@ -31,14 +31,12 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Tests execute-around example.
*/
/** Tests execute-around example. */
class AppTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
@BeforeEach
@@ -38,15 +38,11 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport;
import org.junit.rules.TemporaryFolder;
/**
* SimpleFileWriterTest
*
*/
/** SimpleFileWriterTest */
@EnableRuleMigrationSupport
class SimpleFileWriterTest {
@Rule
public final TemporaryFolder testFolder = new TemporaryFolder();
@Rule public final TemporaryFolder testFolder = new TemporaryFolder();
@Test
void testWriterNotNull() throws Exception {
@@ -74,12 +70,19 @@ class SimpleFileWriterTest {
assertTrue(Files.lines(temporaryFile.toPath()).allMatch(testMessage::equals));
}
@Test
@SneakyThrows
void testRipplesIoExceptionOccurredWhileWriting() {
var message = "Some error";
final var temporaryFile = this.testFolder.newFile();
assertThrows(IOException.class, () -> new SimpleFileWriter(temporaryFile.getPath(), writer -> {throw new IOException("error");}), message);
assertThrows(
IOException.class,
() ->
new SimpleFileWriter(
temporaryFile.getPath(),
writer -> {
throw new IOException("error");
}),
message);
}
}
}