@Test public void testRunSshException() throws Exception { final CclCommandTerminal cclTerminal = mock(CclCommandTerminal.class); final JSchSshTerminal sshTerminal = mock(JSchSshTerminal.class); whenNew(JSchSshTerminal.class).withAnyArguments().thenReturn(sshTerminal); doThrow(new SshException("uh-oh!")).when(cclTerminal).executeCommands(ArgumentMatchers.<JSchSshTerminal> any(), ArgumentMatchers.<List<String>> any(), anyBoolean()); CclCommandException e = assertThrows(CclCommandException.class, () -> { command.run(cclTerminal); }); assertThat(e.getMessage()).isEqualTo("Dropping script " + scriptName + " failed."); }
@Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); @Override void run(final CclCommandTerminal terminal); }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); @Override void run(final CclCommandTerminal terminal);  }