Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.oakfusion.valter;
 
 import org.junit.Test;
 
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public abstract class ValidationTestBase<T> {
	protected static final String DEFAULT_TESTS_NAME_PATTERN = "{index}: {0}";
	private static final Logger LOG = LoggerFactory.getLogger(ValidationTestBase.class);
	protected static Validator validator;
	private T bean;
	private String description;
	private Object expected;
	protected static <T> CaseBuilder forBean(T bean) {
		return new CaseBuilder<>(bean);
	}
	public ValidationTestBase(String description, T beanObject expected) {
		this. = description;
		this. = bean;
		this. = expected;
	}
	private void logViolations(Set<ConstraintViolation<T>> violations) {
		for (ConstraintViolation<T> v : violations) {
			.debug("    {}"v);
		}
	}
		.debug("{}; violations: {}; expected violations: {}"violations.size(), );
		logViolations(violations);
		return violations;
	}
	public void assertViolations(Set<ConstraintViolation<T>> violations) {
		if ( instanceof Integer) {
			assertEquals(violations.size());
else {
		}
	}
	private boolean violationsContainsAnnotation(Set<ConstraintViolation<T>> violationsObject expectedViolation) {
		for (ConstraintViolation<T> violation : violations) {
			Class<? extends AnnotationannotationType = violation.getConstraintDescriptor().getAnnotation().annotationType();
			if (annotationType.equals(expectedViolation)) {
				return true;
			}
		}
		return false;
	}
	public void shouldValidate() {
	}
	public static void setUp() {
		 = factory.getValidator();
	}
New to GrepCode? Check out our FAQ X