Code aufräumen

This commit is contained in:
2026-04-28 08:52:59 +02:00
parent 27b4292c2f
commit 8bb0aabb51
5 changed files with 9 additions and 66 deletions
@@ -9,7 +9,9 @@ package de.gecheckt.pdf.umbenenner.bootstrap.singleinstance;
*/
public class AnotherInstanceRunningException extends RuntimeException {
/**
private static final long serialVersionUID = 159711019801174340L;
/**
* Erstellt eine neue {@code AnotherInstanceRunningException} mit der angegebenen Nachricht.
*
* @param message die Fehlernachricht; darf {@code null} sein
@@ -39,10 +39,10 @@ class SingleInstanceGuardTest {
@Test
void zweiterAcquireWirftAnotherInstanceRunningException() throws Exception {
int port = freienPortErmitteln();
try (SingleInstanceGuard ersterGuard = new SingleInstanceGuard(port)) {
try (SingleInstanceGuard ersterGuard = new SingleInstanceGuard(port);
SingleInstanceGuard zweiterGuard = new SingleInstanceGuard(port)) {
ersterGuard.acquire();
SingleInstanceGuard zweiterGuard = new SingleInstanceGuard(port);
assertThrows(AnotherInstanceRunningException.class, zweiterGuard::acquire,
"Während der erste Guard aktiv ist, soll der zweite acquire() eine "
+ "AnotherInstanceRunningException werfen.");