diff --git a/test/src/test/java/io/jeyong/test/unit/ApplicationTerminatorTest.java b/test/src/test/java/io/jeyong/test/unit/ApplicationTerminatorTest.java index 0b15005..02a5598 100644 --- a/test/src/test/java/io/jeyong/test/unit/ApplicationTerminatorTest.java +++ b/test/src/test/java/io/jeyong/test/unit/ApplicationTerminatorTest.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import sun.misc.Signal; import sun.misc.SignalHandler; @DisplayName("ApplicationTerminator Unit Test") @@ -30,7 +31,7 @@ protected int getExitCode() { }; // when - catchSystemExit(() -> terminator.handleTermination().handle(null)); + catchSystemExit(() -> terminator.handleTermination().handle(new Signal("TERM"))); // then assertThat(Files.readString(tempFile.toPath())).isEqualTo(expectedMessage); @@ -54,7 +55,7 @@ protected int getExitCode() { SignalHandler handler = terminator.handleTermination(); // when - int actualExitCode = catchSystemExit(() -> handler.handle(null)); + int actualExitCode = catchSystemExit(() -> handler.handle(new Signal("TERM"))); // then assertThat(actualExitCode).isEqualTo(expectedExitCode);