@Test
public void testIsValidWithNearestTerminationTime() {
int[][] permutaions = {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}};
for (int[] perm : permutaions) {
Resource resource = new AWSResource().withId("id");
DateTime now = DateTime.now();
BasicJanitorRuleEngine engine = new BasicJanitorRuleEngine()
.addRule(new AlwaysInvalidRule(now, perm[0]))
.addRule(new AlwaysInvalidRule(now, perm[1]))
.addRule(new AlwaysInvalidRule(now, perm[2]));
Assert.assertFalse(engine.isValid(resource));
Assert.assertEquals(
resource.getExpectedTerminationTime().getTime(),
now.plusDays(1).getMillis());
Assert.assertEquals(resource.getTerminationReason(), "1");
}
}