@Test public void getNodeShouldFailIfNodeDoesNotExist() throws Exception { final CLICommandInvoker.Result result = command.authorizedTo(Computer.EXTENDED_READ, Jenkins.READ).invokeWithArgs("MySlave"); assertThat(result.stderr(), containsString("No such node 'MySlave'")); assertThat(result, failedWith(-1)); assertThat(result, hasNoStandardOutput()); }
@Test public void getNodeShouldFailWithoutComputerReadPermission() throws Exception { j.createSlave("MySlave", null, null); final CLICommandInvoker.Result result = command.authorizedTo(Jenkins.READ).invokeWithArgs("MySlave"); assertThat( result.stderr(), containsString("user is missing the Slave/ExtendedRead permission")); assertThat(result, failedWith(-1)); assertThat(result, hasNoStandardOutput()); }