Skip to content

Instantly share code, notes, and snippets.

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/e442c50293a70b9b374f57d719a6de86 to your computer and use it in GitHub Desktop.
Save mgryszko/e442c50293a70b9b374f57d719a6de86 to your computer and use it in GitHub Desktop.
static Stream<Arguments> deleteParams() {
return Stream.of(
Arguments.of(true, inactiveScoresToKeep),
Arguments.of(false, 0)
);
}
@ParameterizedTest
@MethodSource("deleteParams")
void delete(boolean isDefault, int expectedScoresToKeep) {
var profile = ScoringProfile.builder().id(profileId).defaultProfile(isDefault).build();
when(versioner.nextVersion(profile)).thenReturn(version);
when(persisterSupplier.getPersister(profileId, version)).thenReturn(persister);
recalculateService.calculateAndPersist(profile);
var inOrder = inOrder(persister, calculator, versioner);
inOrder.verify(persister).deleteInactive(profileId, expectedScoresToKeep);
inOrder.verify(versioner).deleteInactive(profileId, expectedScoresToKeep);
inOrder.verify(calculator).calculateScores(profile, persister);
inOrder.verify(versioner).calculationFinished(version);
inOrder.verify(versioner).activateVersion(profile, version);
inOrder.verify(persister).deleteInactive(profileId, expectedScoresToKeep);
inOrder.verify(versioner).deleteInactive(profileId, expectedScoresToKeep);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment