Class TypeConstraintInterceptorTest
- java.lang.Object
-
- de.hybris.platform.validation.interceptors.TypeConstraintInterceptorTest
-
@UnitTest public class TypeConstraintInterceptorTest extends java.lang.Object
This class tests theTypeConstraintValidatorandTypeConstraintPrepareronly. The easymock is used to simulate the modelservice calls.
-
-
Constructor Summary
Constructors Constructor Description TypeConstraintInterceptorTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit()create needed dummy data.voidtestPreparer()Test preparer with not compatible target and type.voidtestPreparerWithJavaClass()Test preparer with false java class as target.voidtestPrepareWithEmptyModel()Tests preparer with empty constraint.voidtestValidateWithAnnotationAttributeOnly()Test validator with constrant where only an annotation is set expect: InterceptorException because target is not setvoidtestValidateWithEmptyModel()Test validator with empty constraint Expect: IllegalArgumentException because no annotation class is setvoidtestValidateWithFalseAnnotationAttribute()Test validator with false annotation.voidtestValidator1()Test validator with a constraint where only a pojo as target is set (and the annotation).voidtestValidator2()Test validator, target and type are incompatible to each other.voidtestValidator3()Test validator.voidtestValidator4()Test validator.voidtestValidator5()Test validator where everything is fine.
-
-
-
Method Detail
-
init
public void init()
create needed dummy data.
-
testPrepareWithEmptyModel
public void testPrepareWithEmptyModel() throws InterceptorExceptionTests preparer with empty constraint. Expect: nothing changes, no exception- Throws:
InterceptorException
-
testValidateWithEmptyModel
public void testValidateWithEmptyModel() throws InterceptorExceptionTest validator with empty constraint Expect: IllegalArgumentException because no annotation class is set- Throws:
InterceptorException
-
testValidateWithAnnotationAttributeOnly
public void testValidateWithAnnotationAttributeOnly() throws InterceptorExceptionTest validator with constrant where only an annotation is set expect: InterceptorException because target is not set- Throws:
InterceptorException
-
testValidateWithFalseAnnotationAttribute
public void testValidateWithFalseAnnotationAttribute() throws InterceptorExceptionTest validator with false annotation. Expect: IllegalArgumentException because annotation class is not an annotation- Throws:
InterceptorException
-
testPreparerWithJavaClass
public void testPreparerWithJavaClass() throws InterceptorExceptionTest preparer with false java class as target. Expect: nothing happens- Throws:
InterceptorException
-
testPreparer
public void testPreparer() throws InterceptorExceptionTest preparer with not compatible target and type. Expect: type overwrites the target- Throws:
InterceptorException
-
testValidator1
public void testValidator1() throws InterceptorExceptionTest validator with a constraint where only a pojo as target is set (and the annotation). Expect: nothing happens- Throws:
InterceptorException
-
testValidator2
public void testValidator2() throws InterceptorExceptionTest validator, target and type are incompatible to each other. Expect: IllegalArgumentException- Throws:
InterceptorException
-
testValidator3
public void testValidator3() throws InterceptorExceptionTest validator. target contains a different composedtype as given in the type. Expect: IllegalArgumentException- Throws:
InterceptorException
-
testValidator4
public void testValidator4() throws InterceptorExceptionTest validator. Constraint has only the target set but which is a model. Expect: InterceptorException- Throws:
InterceptorException
-
testValidator5
public void testValidator5() throws InterceptorExceptionTest validator where everything is fine. expect: nothing happens- Throws:
InterceptorException
-
-