1 Reply Latest reply on Jun 18, 2013 2:22 PM by Vikas B

    Method parameter validation

    ikram tahir Newbie

      Hi All,


      how do I call bean validation on method parameters?


      For example in sample app I added @NotNull and @Valid annotations to register method parameter,



      public class MemberRegistration {


         private EntityManager em;


         public void register(@NotNull @Valid Member member) throws Exception {


            // continue if member is not null and valid







      public class MemberRegistrationTest {



         public static Archive<?> createTestArchive() {

            return ShrinkWrap.create(WebArchive.class, "test.war")

                  .addClasses(Member.class, MemberRegistration.class, Resources.class)

                  .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")

                  .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                  // Deploy our test datasource

                  .addAsWebInfResource("test-ds.xml", "test-ds.xml");




         public void should_register() throws Exception {    






      I am expecting above test to fail because of  not null constraint violation.  What am I missing here ? Do I need to configure Jboss-as 7.1.1 ?