public PolicyAssert isModifiedAfter(final Instant Instant) { isNotNull(); assertThat(actual.getModified()).isPresent(); final Instant modified = actual.getModified().get(); assertThat(modified.isAfter(Instant)) // .overridingErrorMessage("Expected <%s> to be after <%s> but it was not", modified, Instant) // .isTrue(); return this; }
public PolicyAssert isNotModifiedAfter(final Instant Instant) { isNotNull(); assertThat(actual.getModified()).isPresent(); final Instant modified = actual.getModified().get(); assertThat(modified.isBefore(Instant)) // .overridingErrorMessage("Expected <%s> to be before <%s> but it was not", modified, Instant) // .isTrue(); return this; }
public PolicyAssert hasNoModified() { isNotNull(); final Optional<Instant> actualmodifiedOptional = actual.getModified(); assertThat(actualmodifiedOptional.isPresent()) // .overridingErrorMessage("Expected Policy not have a modified but it had <%s>", actualmodifiedOptional.orElse(null)) // .isFalse(); return this; }
/** * Returns a new builder for a {@code Policy} based on the given {@code existingPolicy}. * * @param existingPolicy the existing Policy to instantiate the builder with. * @return the new builder. * @throws NullPointerException if {@code existingPolicy} is {@code null}. * @throws PolicyIdInvalidException if {@code policyId} did not comply to {@link Policy#ID_REGEX}. */ public static PolicyBuilder of(final Policy existingPolicy) { checkNotNull(existingPolicy, "existing Policy"); @SuppressWarnings("ConstantConditions") final ImmutablePolicyBuilder result = new ImmutablePolicyBuilder() .setLifecycle(existingPolicy.getLifecycle().orElse(null)) .setRevision(existingPolicy.getRevision().orElse(null)) .setModified(existingPolicy.getModified().orElse(null)); existingPolicy.getId().ifPresent(result::setId); existingPolicy.forEach(result::set); return result; }
public PolicyAssert hasModified(final Instant expectedmodified) { isNotNull(); final Optional<Instant> modifiedOptional = actual.getModified(); assertThat(modifiedOptional) // .overridingErrorMessage("Expected Policy modified to be \n<%s> but it was \n<%s>", expectedmodified, modifiedOptional.orElse(null)) // .contains(expectedmodified); return this; }
public PolicyAssert isEqualEqualToButModified(final Policy expected) { assertThat(expected).isNotNull(); assertThat(actual).isNotNull(); assertThat(actual.getModified()).isPresent(); assertThat(actual.getId()).isEqualTo(expected.getId()); assertThat(actual.getEntriesSet()).isEqualTo(expected.getEntriesSet()); return this; }