UpgradeAction implements Comparable<UpgradeAction> { public boolean isRelevant(final InstallContext ctx, final UpgradeInfo info) throws RepositoryException { return !info.getStatus().isExecuted(ctx, info, this); } UpgradeAction(final String name, final Phase phase, final String contentHash); boolean isRelevant(final InstallContext ctx, final UpgradeInfo info); String getName(); Phase getPhase(); String getContentHash(); abstract void execute(InstallContext ctx); @Override int compareTo(final UpgradeAction o); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testIsRelevant() throws Exception { TestAction action = new TestAction("testName", null, "testHash"); Mockito.when(info.getStatus()).thenReturn(status); Mockito.when(status.isExecuted(ctx, info, action)).thenReturn(false); Assert.assertTrue(action.isRelevant(ctx, info)); Mockito.when(status.isExecuted(ctx, info, action)).thenReturn(true); Assert.assertFalse(action.isRelevant(ctx, info)); }