@Test
public void shouldRemoveIfStopped() {

    // given
    final JobInfo foo = jobInfo("foo", "T_FOO");
    final JobInfo bar = someRunningJobInfo("bar", "T_BAR", now());
    repo.createOrUpdate(foo);
    repo.createOrUpdate(bar);
    // when
    repo.removeIfStopped("foo");
    repo.removeIfStopped("bar");
    // then
    assertThat(repo.findAll(), hasSize(1));
    assertThat(repo.findAll(), contains(bar));
}