Conditionals { public Conditionals ifModifiedSince(LocalDateTime time) { Preconditions.checkArgument(match.isEmpty(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MODIFIED_SINCE, HeaderConstants.IF_MATCH)); Preconditions.checkArgument(!unModifiedSince.isPresent(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MODIFIED_SINCE, HeaderConstants.IF_UNMODIFIED_SINCE)); time = time.withNano(0); return new Conditionals(empty(), noneMatch, Optional.of(time), Optional.empty()); } Conditionals();  Conditionals(List<Tag> match, List<Tag> noneMatch, Optional<LocalDateTime> modifiedSince, Optional<LocalDateTime> unModifiedSince); Conditionals addIfMatch(Tag tag); Conditionals addIfNoneMatch(Tag tag); Conditionals ifModifiedSince(LocalDateTime time); Conditionals ifUnModifiedSince(LocalDateTime time); List<Tag> getMatch(); List<Tag> getNoneMatch(); Optional<LocalDateTime> getModifiedSince(); Optional<LocalDateTime> getUnModifiedSince(); boolean isUnconditional(); Headers toHeaders(); static Conditionals valueOf(Headers headers);  }
@Test public void testIfModifiedSince() { Conditionals conditionals = new Conditionals(); LocalDateTime dateTime = LocalDateTime.now(); conditionals = conditionals.ifModifiedSince(dateTime); Header header = HeaderUtils.toHttpDate(HeaderConstants.IF_MODIFIED_SINCE, dateTime); assertEquals(header, conditionals.toHeaders().getFirstHeader(HeaderConstants.IF_MODIFIED_SINCE).get()); }