@Test
public void shouldApplyOnlyLatestUpgrades() throws Exception {

    testUpgrades.applyUpgradesSince(0, null);
    operation1.assertCalled();
    operation2.assertCalled();
    operation3.assertCalled();
    testUpgrades.applyUpgradesSince(1, null);
    operation1.assertCalled();
    operation2.assertCalled();
    operation3.assertCalled();
    testUpgrades.applyUpgradesSince(2, null);
    operation1.assertNotCalled();
    operation2.assertCalled();
    operation3.assertCalled();
    testUpgrades.applyUpgradesSince(3, null);
    operation1.assertNotCalled();
    operation2.assertNotCalled();
    operation3.assertCalled();
    testUpgrades.applyUpgradesSince(4, null);
    operation1.assertNotCalled();
    operation2.assertNotCalled();
    operation3.assertNotCalled();
    testUpgrades.applyUpgradesSince(5, null);
    operation1.assertNotCalled();
    operation2.assertNotCalled();
    operation3.assertNotCalled();
}