Package unit.validation

Source Code of unit.validation.RequiredValidationTest

package unit.validation;

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

import static com.google.common.collect.Lists.newArrayList;

public class RequiredValidationTest extends ValidationTest<RequiredModel> {

    @Override
    protected Builder<RequiredModel> valid() {
        return new RequiredModelBuilder();
    }

    @Test
    public void requiredString() {
        assertThat("requiredString").isRequired();
    }

    @Test
    public void requiredCollection() {
        assertThat("requiredCollection").withValue(newArrayList()).isInvalid();
        assertThat("requiredCollection").isRequired();
    }

    private class RequiredModelBuilder extends Builder<RequiredModel> {
        @Override
        public RequiredModel build() {
            RequiredModel model = new RequiredModel();
            model.requiredString = "aString";
            model.requiredCollection = newArrayList("a", "b");
            return model;
        }
    }
}
TOP

Related Classes of unit.validation.RequiredValidationTest

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.