Package org.apache.bval.jsr
Class ExceptionsContractTest
- java.lang.Object
-
- org.apache.bval.jsr.ValidationTestBase
-
- org.apache.bval.jsr.ExceptionsContractTest
-
public class ExceptionsContractTest extends ValidationTestBase
Several checks to validate that the implementations ofValidator
andBeanDescriptor
throw the correct exceptions as per the spec.- Author:
- Carlos Vara
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExceptionsContractTest.ExceptionThrowingBean
static class
ExceptionsContractTest.Person
-
Field Summary
-
Fields inherited from class org.apache.bval.jsr.ValidationTestBase
factory, validator
-
-
Constructor Summary
Constructors Constructor Description ExceptionsContractTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
testExceptionThrowingBean()
Checks that the correct exception is thrown when validating a bean whose getter throws an exception.void
testGetConstraintsForEmptyProperty()
Checks that anIllegalArgumentException
is thrown when callingBeanDescriptor.getConstraintsForProperty(String)
with an invalid property name.void
testGetConstraintsForNullProperty()
Checks that anIllegalArgumentException
is thrown when callingBeanDescriptor.getConstraintsForProperty(String)
with an invalid property name.void
testValidateEmptyPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an empty property name.void
testValidateIncompatiblePrimitiveValue()
Enforces the "not a valid object property" part of theIllegalArgumentException
declaration onValidator.validateValue(Class, String, Object, Class...)
void
testValidateIncompatibleValue()
Enforces the "not a valid object property" part of theIllegalArgumentException
declaration onValidator.validateValue(Class, String, Object, Class...)
void
testValidateInvalidPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an invalid property name.void
testValidateNullGroup()
Checks that anIllegalArgumentException
is thrown when passingnull
as group array.void
testValidateNullPropertyName()
Checks that anIllegalArgumentException
is thrown when passing anull
property name.void
testValidatePropertyNullGroup()
Checks that anIllegalArgumentException
is thrown when passingnull
as group array in aValidator.validateProperty(Object, String, Class...)
call.void
testValidatePropertyOnNullBean()
Checks that anIllegalArgumentException
is thrown when trying to validate a property on a null object.void
testValidateValueEmptyPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an empty property name toValidator.validateValue(Class, String, Object, Class...)
.void
testValidateValueInvalidPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an invalid property name toValidator.validateValue(Class, String, Object, Class...)
.void
testValidateValueNullGroup()
Checks that anIllegalArgumentException
is thrown when callingValidator.validateValue(Class, String, Object, Class...)
with anull
group array.void
testValidateValueNullPropertyName()
Checks that anIllegalArgumentException
is thrown when passing anull
property name toValidator.validateValue(Class, String, Object, Class...)
.void
testValidateValueOnNullClass()
Checks that anIllegalArgumentException
is thrown when callingValidator.validateValue(Class, String, Object, Class...)
with anull
class.-
Methods inherited from class org.apache.bval.jsr.ValidationTestBase
createValidator, setUp, setupValidatorFactory
-
-
-
-
Method Detail
-
testExceptionThrowingBean
public void testExceptionThrowingBean()
Checks that the correct exception is thrown when validating a bean whose getter throws an exception.
-
testValidateNullGroup
public void testValidateNullGroup()
Checks that anIllegalArgumentException
is thrown when passingnull
as group array.
-
testValidateNullPropertyName
public void testValidateNullPropertyName()
Checks that anIllegalArgumentException
is thrown when passing anull
property name.
-
testValidateEmptyPropertyName
public void testValidateEmptyPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an empty property name.
-
testValidateInvalidPropertyName
public void testValidateInvalidPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an invalid property name.
-
testValidatePropertyOnNullBean
public void testValidatePropertyOnNullBean()
Checks that anIllegalArgumentException
is thrown when trying to validate a property on a null object.
-
testValidatePropertyNullGroup
public void testValidatePropertyNullGroup()
Checks that anIllegalArgumentException
is thrown when passingnull
as group array in aValidator.validateProperty(Object, String, Class...)
call.
-
testValidateValueOnNullClass
public void testValidateValueOnNullClass()
Checks that anIllegalArgumentException
is thrown when callingValidator.validateValue(Class, String, Object, Class...)
with anull
class.
-
testValidateValueNullPropertyName
public void testValidateValueNullPropertyName()
Checks that anIllegalArgumentException
is thrown when passing anull
property name toValidator.validateValue(Class, String, Object, Class...)
.
-
testValidateValueEmptyPropertyName
public void testValidateValueEmptyPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an empty property name toValidator.validateValue(Class, String, Object, Class...)
.
-
testValidateValueInvalidPropertyName
public void testValidateValueInvalidPropertyName()
Checks that anIllegalArgumentException
is thrown when passing an invalid property name toValidator.validateValue(Class, String, Object, Class...)
.
-
testValidateValueNullGroup
public void testValidateValueNullGroup()
Checks that anIllegalArgumentException
is thrown when callingValidator.validateValue(Class, String, Object, Class...)
with anull
group array.
-
testValidateIncompatibleValue
public void testValidateIncompatibleValue()
Enforces the "not a valid object property" part of theIllegalArgumentException
declaration onValidator.validateValue(Class, String, Object, Class...)
-
testValidateIncompatiblePrimitiveValue
public void testValidateIncompatiblePrimitiveValue()
Enforces the "not a valid object property" part of theIllegalArgumentException
declaration onValidator.validateValue(Class, String, Object, Class...)
-
testGetConstraintsForNullProperty
public void testGetConstraintsForNullProperty()
Checks that anIllegalArgumentException
is thrown when callingBeanDescriptor.getConstraintsForProperty(String)
with an invalid property name.
-
testGetConstraintsForEmptyProperty
public void testGetConstraintsForEmptyProperty()
Checks that anIllegalArgumentException
is thrown when callingBeanDescriptor.getConstraintsForProperty(String)
with an invalid property name.
-
-