All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.thucydides.core.matchers.dates.DateTimeIsBeforeMatcher Maven / Gradle / Ivy

There is a newer version: 4.1.20
Show newest version
package net.thucydides.core.matchers.dates;

import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.joda.time.DateTime;

import static net.thucydides.core.matchers.dates.DateMatcherFormatter.formatted;


class DateTimeIsBeforeMatcher extends TypeSafeMatcher {

    private final DateTime expectedDate;

    public DateTimeIsBeforeMatcher(final DateTime expectedDate) {
        this.expectedDate = expectedDate;
    }

    public boolean matchesSafely(DateTime provided) {
        return provided.isBefore(expectedDate);
    }

    public void describeTo(Description description) {
        description.appendText("a date that is before ");
        description.appendText(formatted(expectedDate));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy