Source:
public void offlineNodeManyShouldSucceed() throws Exception { DumbSlave slave1 = j.createSlave("aNode1", "", null); DumbSlave slave2 = j.createSlave("aNode2", "", null); DumbSlave slave3 = j.createSlave("aNode3", "", null); slave1.toComputer().waitUntilOnline(); assertThat(slave1.toComputer().isOnline(), equalTo(true)); assertThat(slave1.toComputer().getOfflineCause(), equalTo(null)); slave2.toComputer().waitUntilOnline(); assertThat(slave2.toComputer().isOnline(), equalTo(true)); assertThat(slave2.toComputer().getOfflineCause(), equalTo(null)); slave3.toComputer().waitUntilOnline(); assertThat(slave3.toComputer().isOnline(), equalTo(true)); assertThat(slave3.toComputer().getOfflineCause(), equalTo(null)); final CLICommandInvoker.Result result = command .authorizedTo(Computer.DISCONNECT, Jenkins.READ) .invokeWithArgs("aNode1", "aNode2", "aNode3"); assertThat(result, succeededSilently()); assertThat(slave1.toComputer().isOffline(), equalTo(true)); assertThat(slave1.toComputer().getOfflineCause() instanceof OfflineCause.ByCLI, equalTo(true)); assertThat(((OfflineCause.ByCLI) slave1.toComputer().getOfflineCause()).message, equalTo(null)); assertThat(slave2.toComputer().isOffline(), equalTo(true)); assertThat(slave2.toComputer().getOfflineCause() instanceof OfflineCause.ByCLI, equalTo(true)); assertThat(((OfflineCause.ByCLI) slave2.toComputer().getOfflineCause()).message, equalTo(null)); assertThat(slave3.toComputer().isOffline(), equalTo(true)); assertThat(slave3.toComputer().getOfflineCause() instanceof OfflineCause.ByCLI, equalTo(true)); assertThat(((OfflineCause.ByCLI) slave3.toComputer().getOfflineCause()).message, equalTo(null)); }

Target:
public void offlineNodeManyShouldSucceed() throws Exception { DumbSlave slave1 = j.createSlave("aNode1", "", null); DumbSlave slave2 = j.createSlave("aNode2", "", null); DumbSlave slave3 = j.createSlave("aNode3", "", null); slave1.toComputer().waitUntilOnline(); assertThat(slave1.toComputer().isOnline(), equalTo(true)); assertThat(slave1.toComputer().getOfflineCause(), equalTo(null)); slave2.toComputer().waitUntilOnline(); assertThat(slave2.toComputer().isOnline(), equalTo(true)); assertThat(slave2.toComputer().getOfflineCause(), equalTo(null)); slave3.toComputer().waitUntilOnline(); assertThat(slave3.toComputer().isOnline(), equalTo(true)); assertThat(slave3.toComputer().getOfflineCause(), equalTo(null)); final CLICommandInvoker.Result result = command .authorizedTo(Computer.DISCONNECT, Jenkins.READ) .invokeWithArgs("aNode1", "aNode2", "aNode3"); assertThat(result, succeededSilently()); assertThat(slave1.toComputer().isOffline(), equalTo(true)); assertThat(slave1.toComputer().getOfflineCause(), instanceOf(OfflineCause.ByCLI.class)); assertThat(((OfflineCause.ByCLI) slave1.toComputer().getOfflineCause()).message, equalTo(null)); assertThat(slave2.toComputer().isOffline(), equalTo(true)); assertThat(slave2.toComputer().getOfflineCause(), instanceOf(OfflineCause.ByCLI.class)); assertThat(((OfflineCause.ByCLI) slave2.toComputer().getOfflineCause()).message, equalTo(null)); assertThat(slave3.toComputer().isOffline(), equalTo(true)); assertThat(slave3.toComputer().getOfflineCause(), instanceOf(OfflineCause.ByCLI.class)); assertThat(((OfflineCause.ByCLI) slave3.toComputer().getOfflineCause()).message, equalTo(null)); }