Test command line and returning the result of execution.
| 40 | * Test command line and returning the result of execution. |
| 41 | */ |
| 42 | class ExecutingCommandTest { |
| 43 | |
| 44 | private static final String ECHO = SystemInfo.getCurrentPlatform().equals(PlatformEnum.WINDOWS) |
| 45 | ? "cmd.exe /C echo Test" |
| 46 | : "echo Test"; |
| 47 | private static final String BAD_COMMAND = "noOSshouldHaveACommandNamedThis"; |
| 48 | |
| 49 | @Test |
| 50 | void testRunNative() { |
| 51 | List<String> test = ExecutingCommand.runNative(ECHO); |
| 52 | assertThat("echo output", test, hasSize(1)); |
| 53 | assertThat("echo output", test.get(0), is("Test")); |
| 54 | assertThat("echo first answer", ExecutingCommand.getFirstAnswer(ECHO), is("Test")); |
| 55 | |
| 56 | assertThat("bad command", ExecutingCommand.runNative(BAD_COMMAND), is(empty())); |
| 57 | assertThat("bad command first answer", ExecutingCommand.getFirstAnswer(BAD_COMMAND), is(emptyString())); |
| 58 | } |
| 59 | } |
nothing calls this directly
no test coverage detected