Skip to content

Instantly share code, notes, and snippets.

@elefevre
Created August 8, 2012 16:34
Show Gist options
  • Save elefevre/3296455 to your computer and use it in GitHub Desktop.
Save elefevre/3296455 to your computer and use it in GitHub Desktop.
public class ConnectorExecutionCleanerTest {
private static final Connector CONNECTOR = new Connector("type", "name");
private LocalWorkStore mockLocalWorkStore = mock(LocalWorkStore.class);
private LocalDataStore mockLocalDataStore = mock(LocalDataStore.class);
private Statistics mockStatistics = mock(Statistics.class);
private SystemProcessStatus mockSystemProcessStatus = mock(SystemProcessStatus.class);
private ConnectorExecutionCleaner cleaner = new ConnectorExecutionCleaner(mockLocalWorkStore, mockLocalDataStore, mockStatistics, mockSystemProcessStatus);
@Test
public void can_clean_all_execution_files() throws IOException {
when(mockLocalWorkStore.listFiles()).thenReturn(
Lists.<String>newArrayList("err.txt", "out.txt", "session.lock", "pid.out", "run"));
cleaner.clean(CONNECTOR);
verify(mockLocalWorkStore).delete(CONNECTOR, "err.txt");
verify(mockLocalWorkStore).delete(CONNECTOR, "out.txt");
verify(mockLocalWorkStore).delete(CONNECTOR, "session.lock");
verify(mockLocalWorkStore).delete(CONNECTOR, "run");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment