Package unit.validation

Source Code of unit.validation.PhoneValidationTest

package unit.validation;

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

public class PhoneValidationTest extends ValidationTest<PhoneModel> {

    @Override
    protected Builder<PhoneModel> valid() {
        return new PhoneModelBuilder();

    }

    @Test
    public void validPhone() {
        assertThat("phone").withValue(null).isValid();
        assertThat("phone").withValue("not a phone").isInvalid();
        assertThat("phone").mustBeAPhoneNumber();
    }

    private class PhoneModelBuilder extends Builder<PhoneModel> {
        @Override
        public PhoneModel build() {
            PhoneModel model = new PhoneModel();
            model.phone = "+32 123 44 55 66";
            return model;
        }
    }
}
TOP

Related Classes of unit.validation.PhoneValidationTest

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.