IntentRemoveShellCommand extends OsgiCommandSupport { @Override protected Object doExecute() throws Exception { Uuid uuid = Uuid.getDefaultInstance(id); if (provider.removeIntent(uuid)) { return String.format("Intent successfully removed (id: %s)", uuid.toString()); } else { return String.format("Error removing intent (id: %s)", uuid.toString()); } } IntentRemoveShellCommand(NicConsoleProvider provider);   }
@Test public final void testDoExecute() throws Exception { PowerMockito.stub(PowerMockito.method(Uuid.class, "getDefaultInstance")).toReturn(uuid); when(nicConsole.removeIntent(uuid)).thenReturn(true); Object output = intentRemoveShellCmd.doExecute(); Object feedBack = "Intent successfully removed (id: Uuid [_value="+id+"])"; assertTrue(output instanceof Object); assertEquals(feedBack, output); when(nicConsole.removeIntent(uuid)).thenReturn(false); Object result = intentRemoveShellCmd.doExecute(); Object expected = "Error removing intent (id: Uuid [_value="+id+"])"; assertTrue(result instanceof Object); assertEquals(expected, result); }