use of org.androidannotations.ElementValidation in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method stringParam.
@Test
public void stringParam() throws Exception {
ExecutableElement executableElement = createMethod(String.class);
ElementValidation valid = new ElementValidation("", executableElement);
validator.type(CanonicalNameConstants.STRING).validate(executableElement, valid);
assertTrue(valid.isValid());
executableElement = createMethod(int.class);
valid = new ElementValidation("", executableElement);
validator.noParam().validate(executableElement, valid);
assertFalse(valid.isValid());
}
use of org.androidannotations.ElementValidation in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method annotatedParam.
@Test
public void annotatedParam() throws Exception {
ExecutableElement executableElement = createMethod(p(String.class, TestAnnotation.class));
ElementValidation valid = new ElementValidation("", executableElement);
validator.annotatedWith(TestAnnotation.class).validate(executableElement, valid);
assertTrue(valid.isValid());
}
use of org.androidannotations.ElementValidation in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method inOrderSuccess2.
@Test
public void inOrderSuccess2() throws Exception {
ExecutableElement executableElement = createMethod(boolean.class, boolean.class, int.class);
ElementValidation valid = new ElementValidation("", executableElement);
//
validator.inOrder().type(boolean.class.getName()).multiple().type(long.class.getName()).optional().type(//
int.class.getName()).validate(executableElement, valid);
assertTrue(valid.isValid());
}
use of org.androidannotations.ElementValidation in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method noParam.
@Test
public void noParam() throws Exception {
ExecutableElement executableElement = createMethod();
ElementValidation valid = new ElementValidation("", executableElement);
validator.noParam().validate(executableElement, valid);
assertTrue(valid.isValid());
executableElement = createMethod(int.class);
valid = new ElementValidation("", executableElement);
validator.noParam().validate(executableElement, valid);
assertFalse(valid.isValid());
}
use of org.androidannotations.ElementValidation in project androidannotations by androidannotations.
the class ValidatorParameterHelperTest method inOrderFail2.
@Test
public void inOrderFail2() throws Exception {
ExecutableElement executableElement = createMethod(long.class, boolean.class);
ElementValidation valid = new ElementValidation("", executableElement);
//
validator.inOrder().type(boolean.class.getName()).multiple().type(long.class.getName()).optional().type(int.class.getName()).optional().validate(executableElement, valid);
assertFalse(valid.isValid());
}
Aggregations