Annotation annotation = violation.constraint(); String message; try result += violation.value() == null ? "null" : violation.value().toString();
Annotation annotation = violation.constraint(); String name = violation.name(); Object value = violation.value(); String classes; if( Iterables.count( instanceTypes ) == 1 )
@Test public void givenInvalidCacheNameWhenFetchingCacheExpectNullArgumentException() { try { cache = cachePool.fetchCache( "", String.class ); fail( "Expected " + NullArgumentException.class.getSimpleName() ); } catch( NullArgumentException e ) { // expected } try { cache = cachePool.fetchCache( null, String.class ); fail( "Expected " + NullArgumentException.class.getSimpleName() ); } catch( ConstraintViolationException e ) { // expected Collection<ConstraintViolation> violations = e.constraintViolations(); assertEquals( 1, violations.size() ); ConstraintViolation violation = violations.iterator().next(); assertEquals( "not optional", violation.constraint().toString() ); assertEquals( "param1", violation.name() ); } }