Skip to content

Instantly share code, notes, and snippets.

@mgryszko
Created February 12, 2022 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgryszko/78f97e866f8688f040820cd9072b1277 to your computer and use it in GitHub Desktop.
Save mgryszko/78f97e866f8688f040820cd9072b1277 to your computer and use it in GitHub Desktop.
ScoreCleaner cleaner = mock(ScoreCleaner.class);
@Test
void delete() {
// I don't care whether the profile is default of not
var profile = ScoringProfile.builder().id(profileId).build();
when(versioner.nextVersion(profile)).thenReturn(version);
when(persisterSupplier.getPersister(profileId, version)).thenReturn(persister);
recalculateService.calculateAndPersist(profile);
var inOrder = inOrder(calculator, versioner, cleaner);
inOrder.verify(cleaner).deleteInactive(profileId);
inOrder.verify(calculator).calculateScores(profile, persister);
inOrder.verify(versioner).calculationFinished(version);
inOrder.verify(versioner).activateVersion(profile, version);
inOrder.verify(cleaner).deleteInactive(profileId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment