Class TypeConstraintInterceptorTest
java.lang.Object
de.hybris.platform.validation.interceptors.TypeConstraintInterceptorTest
This class tests the
TypeConstraintValidator and TypeConstraintPreparer only. The easymock is used to
simulate the modelservice calls.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()create needed dummy data.voidTest preparer with not compatible target and type.voidTest preparer with false java class as target.voidTests preparer with empty constraint.voidTest validator with constrant where only an annotation is set expect: InterceptorException because target is not setvoidTest validator with empty constraint Expect: IllegalArgumentException because no annotation class is setvoidTest validator with false annotation.voidTest validator with a constraint where only a pojo as target is set (and the annotation).voidTest validator, target and type are incompatible to each other.voidTest validator.voidTest validator.voidTest validator where everything is fine.
-
Constructor Details
-
TypeConstraintInterceptorTest
public TypeConstraintInterceptorTest()
-
-
Method Details
-
init
public void init()create needed dummy data. -
testPrepareWithEmptyModel
Tests preparer with empty constraint. Expect: nothing changes, no exception- Throws:
InterceptorException
-
testValidateWithEmptyModel
Test validator with empty constraint Expect: IllegalArgumentException because no annotation class is set- Throws:
InterceptorException
-
testValidateWithAnnotationAttributeOnly
Test validator with constrant where only an annotation is set expect: InterceptorException because target is not set- Throws:
InterceptorException
-
testValidateWithFalseAnnotationAttribute
Test validator with false annotation. Expect: IllegalArgumentException because annotation class is not an annotation- Throws:
InterceptorException
-
testPreparerWithJavaClass
Test preparer with false java class as target. Expect: nothing happens- Throws:
InterceptorException
-
testPreparer
Test preparer with not compatible target and type. Expect: type overwrites the target- Throws:
InterceptorException
-
testValidator1
Test validator with a constraint where only a pojo as target is set (and the annotation). Expect: nothing happens- Throws:
InterceptorException
-
testValidator2
Test validator, target and type are incompatible to each other. Expect: IllegalArgumentException- Throws:
InterceptorException
-
testValidator3
Test validator. target contains a different composedtype as given in the type. Expect: IllegalArgumentException- Throws:
InterceptorException
-
testValidator4
Test validator. Constraint has only the target set but which is a model. Expect: InterceptorException- Throws:
InterceptorException
-
testValidator5
Test validator where everything is fine. expect: nothing happens- Throws:
InterceptorException
-