Skip to content

Commit

Permalink
Add a test for Python service startup failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed Oct 18, 2023
1 parent 0121cfb commit eb899b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/org/apposed/appose/ApposeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -85,6 +86,21 @@ public void testPython() throws IOException, InterruptedException {
}
}

@Test
public void testServiceStartupFailure() throws IOException {
Environment env = Appose.base("no-pythons-to-be-found-here").build();
try (Service service = env.python()) {
fail("Python worker process started successfully!?");
}
catch (IllegalArgumentException exc) {
assertEquals(
"No executables found amongst candidates: " +
"[python, python.exe, bin/python, bin/python.exe]",
exc.getMessage()
);
}
}

public void executeAndAssert(Service service, String script)
throws InterruptedException, IOException
{
Expand Down

0 comments on commit eb899b4

Please sign in to comment.