ProcessMonitorImpl implements ProcessMonitor { @Override public void remove(ProcessLauncher processLauncher) { processMap.remove(processLauncher.getProcessId()); }  @Override ProcessLauncher get(String processId); @Override void add(ProcessLauncher processLauncher); @Override void remove(ProcessLauncher processLauncher); @Override Set<String> getProcessIds(); @Override void stop(String processId); @Override void stopAll();  }
@Test public void testRemove() throws Exception { when(processLauncherMock1.getProcessId()).thenReturn("p1"); Set<String> processIds = null; testling.add(processLauncherMock1); processIds = testling.getProcessIds(); Assert.assertEquals(processIds.size(), 1); testling.remove(processLauncherMock1); processIds = testling.getProcessIds(); Assert.assertEquals(processIds.size(), 0); testling.remove(processLauncherMock1); processIds = testling.getProcessIds(); Assert.assertEquals(processIds.size(), 0); }