Package unit.validation

Source Code of unit.validation.FutureValidationTest

package unit.validation;

import litmus.Builder;
import litmus.unit.validation.ValidationTest;
import models.FutureModel;
import org.junit.Test;

import static litmus.util.DateUtil.*;

public class FutureValidationTest extends ValidationTest<FutureModel> {

    @Override
    protected Builder<FutureModel> valid() {
        return new Builder<FutureModel>() {
            public FutureModel build() {
                FutureModel model = new FutureModel();
                model.futureDate = tomorrow();
                model.dateAfter1Jan2100 = asDate("2222-01-01");
                return model;
            }
        };
    }

    @Test
    public void futureDate() {
        assertThat("futureDate").isInvalidWhenEqualTo(yesterday());
        assertThat("futureDate").mustBeInTheFuture();
    }

    @Test
    public void dateAfterAGivenDate() {
        assertThat("dateAfter1Jan2100").mustBeAfter(asDate("2100-01-01"));
        assertThat("dateAfter1Jan2100").mustBeAfter("2100-01-01");
    }


}
TOP

Related Classes of unit.validation.FutureValidationTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.