|
2 | 2 | import gobpie.GobPieConfReader; |
3 | 3 | import gobpie.GobPieConfiguration; |
4 | 4 | import gobpie.GobPieException; |
| 5 | +import guru.nidi.graphviz.service.CommandRunner; |
5 | 6 | import magpiebridge.core.MagpieServer; |
6 | 7 | import org.junit.jupiter.api.Test; |
7 | 8 | import org.junit.jupiter.api.extension.ExtendWith; |
| 9 | +import org.mockito.MockedConstruction; |
| 10 | +import org.zeroturnaround.exec.ProcessExecutor; |
| 11 | +import org.zeroturnaround.exec.ProcessOutput; |
| 12 | +import org.zeroturnaround.exec.ProcessResult; |
8 | 13 | import uk.org.webcompere.systemstubs.jupiter.SystemStub; |
9 | 14 | import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension; |
10 | 15 | import uk.org.webcompere.systemstubs.stream.SystemOut; |
11 | 16 |
|
| 17 | +import java.io.IOException; |
| 18 | +import java.nio.charset.StandardCharsets; |
12 | 19 | import java.util.List; |
13 | 20 |
|
14 | 21 | import static org.junit.jupiter.api.Assertions.*; |
@@ -64,7 +71,7 @@ public void testStartGoblintServerFailed() { |
64 | 71 | GoblintServer goblintServer = spy(new GoblintServer(magpieServer, gobPieConfiguration)); |
65 | 72 |
|
66 | 73 | // Mock behavior to return the executable command and abstract debugging |
67 | | - when(gobPieConfiguration.goblintExecutable()).thenReturn("goblint"); |
| 74 | + when(gobPieConfiguration.goblintExecutable()).thenReturn("/definitely/not/a/real/binary"); |
68 | 75 | when(gobPieConfiguration.abstractDebugging()).thenReturn(true); |
69 | 76 |
|
70 | 77 | // Assert that starting Goblint server throws GobPieException |
@@ -104,16 +111,12 @@ public void testCheckGoblintVersion() { |
104 | 111 | @Test |
105 | 112 | public void testCheckGoblintVersionFailed() { |
106 | 113 | MagpieServer magpieServer = mock(MagpieServer.class); |
107 | | - |
108 | | - // Prepare test data |
109 | | - String fileName = "gobpieTest7.json"; |
110 | | - String gobPieConfFileName = GobPieConfTest.class.getResource(fileName).getFile(); |
111 | | - |
112 | | - // Mock everything needed for creating goblintServer |
113 | | - GobPieConfReader gobPieConfReader = new GobPieConfReader(magpieServer, gobPieConfFileName); |
114 | | - GobPieConfiguration gobPieConfiguration = gobPieConfReader.readGobPieConfiguration(); |
| 114 | + GobPieConfiguration gobPieConfiguration = mock(GobPieConfiguration.class); |
115 | 115 | GoblintServer goblintServer = new GoblintServer(magpieServer, gobPieConfiguration); |
116 | 116 |
|
| 117 | + // Mock behavior to return the executable command |
| 118 | + when(gobPieConfiguration.goblintExecutable()).thenReturn("/definitely/not/a/real/binary"); |
| 119 | + |
117 | 120 | // Assert that checking the Goblint version throws GobPieException |
118 | 121 | GobPieException thrown = assertThrows(GobPieException.class, goblintServer::checkGoblintVersion); |
119 | 122 | assertEquals("Checking version failed.", thrown.getMessage()); |
|
0 commit comments