Skip to content

Commit

Permalink
fix: 시그널의 이름을 불러오지 못해 테스트가 깨지는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
joon6093 committed Dec 18, 2024
1 parent 1c9d9a6 commit b4f997a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit b4f997a

Please sign in to comment.