Class TypeConstraintInterceptorTest

java.lang.Object
de.hybris.platform.validation.interceptors.TypeConstraintInterceptorTest

@UnitTest public class TypeConstraintInterceptorTest extends Object
This class tests the TypeConstraintValidator and TypeConstraintPreparer only. The easymock is used to simulate the modelservice calls.
  • Constructor Details

    • TypeConstraintInterceptorTest

      public TypeConstraintInterceptorTest()
  • Method Details

    • init

      public void init()
      create needed dummy data.
    • testPrepareWithEmptyModel

      public void testPrepareWithEmptyModel() throws InterceptorException
      Tests preparer with empty constraint. Expect: nothing changes, no exception
      Throws:
      InterceptorException
    • testValidateWithEmptyModel

      public void testValidateWithEmptyModel() throws InterceptorException
      Test validator with empty constraint Expect: IllegalArgumentException because no annotation class is set
      Throws:
      InterceptorException
    • testValidateWithAnnotationAttributeOnly

      public void testValidateWithAnnotationAttributeOnly() throws InterceptorException
      Test validator with constrant where only an annotation is set expect: InterceptorException because target is not set
      Throws:
      InterceptorException
    • testValidateWithFalseAnnotationAttribute

      public void testValidateWithFalseAnnotationAttribute() throws InterceptorException
      Test validator with false annotation. Expect: IllegalArgumentException because annotation class is not an annotation
      Throws:
      InterceptorException
    • testPreparerWithJavaClass

      public void testPreparerWithJavaClass() throws InterceptorException
      Test preparer with false java class as target. Expect: nothing happens
      Throws:
      InterceptorException
    • testPreparer

      public void testPreparer() throws InterceptorException
      Test preparer with not compatible target and type. Expect: type overwrites the target
      Throws:
      InterceptorException
    • testValidator1

      public void testValidator1() throws InterceptorException
      Test 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 InterceptorException
      Test validator, target and type are incompatible to each other. Expect: IllegalArgumentException
      Throws:
      InterceptorException
    • testValidator3

      public void testValidator3() throws InterceptorException
      Test validator. target contains a different composedtype as given in the type. Expect: IllegalArgumentException
      Throws:
      InterceptorException
    • testValidator4

      public void testValidator4() throws InterceptorException
      Test validator. Constraint has only the target set but which is a model. Expect: InterceptorException
      Throws:
      InterceptorException
    • testValidator5

      public void testValidator5() throws InterceptorException
      Test validator where everything is fine. expect: nothing happens
      Throws:
      InterceptorException