Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1298

TestResourceWithGetterViolation and TestGetterReturnValueNotValidated fails with validation error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.15.Final
    • 3.0.14.Final
    • None
    • None

      Description of problem:
      TestResourceWithGetterViolation and TestGetterReturnValueNotValidated fails with validation error. These test expects, that Hibernate Validator is called three times in REST end-point. This behaviour was introduced in RE by this commit. But Hibernate Validator is obviously called only twice.

      Test pass, if REST end-poing expects only two calling of Hibernate in TestResourceWithGetterViolation class on line 29:

      String s = count++ <= 1 ? "abc" : "a";
      

      How reproducible:
      Always on EAP 7.0.0.ER5

      Steps to Reproduce: (use attached reproducer)

      1. mvn test -Djboss.home=${EAP_HOME}

      Actual results: (TestGetterReturnValueNotValidated)

      12:09:22,318 INFO  [stdout] (default task-4) getS(): count: 0
      12:09:22,318 INFO  [stdout] (default task-4) s: abc
      12:09:22,319 INFO  [stdout] (default task-4) getS(): count: 1
      12:09:22,319 INFO  [stdout] (default task-4) s: abc
      12:09:22,324 INFO  [stdout] (default task-4) getS(): count: 2
      12:09:22,324 INFO  [stdout] (default task-4) s: abc
      12:09:22,342 INFO  [stdout] (default task-1) status: 200
      12:09:22,345 INFO  [stdout] (default task-1) entity: abc
      
      junit.framework.AssertionFailedError: 
      Expected :a
      Actual   :abc
      
      	at junit.framework.Assert.fail(Assert.java:57)
      	at junit.framework.Assert.failNotEquals(Assert.java:329)
      	at junit.framework.Assert.assertEquals(Assert.java:78)
      	at junit.framework.Assert.assertEquals(Assert.java:86)
      	at org.jboss.resteasy.test.validation.TestGetterReturnValueNotValidated.testReturnValues(TestGetterReturnValueNotValidated.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
      	at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      

      Actual results: (TestGetterReturnValueValidated)

      12:09:23,628 INFO  [org.hibernate.validator.internal.xml.ValidationXmlParser] (default task-7) HV000007: META-INF/validation.xml found. Parsing XML based configuration.
      12:09:23,641 INFO  [stdout] (default task-7) getS(): count: 0
      12:09:23,641 INFO  [stdout] (default task-7) s: abc
      12:09:23,641 INFO  [stdout] (default task-7) getS(): count: 1
      12:09:23,641 INFO  [stdout] (default task-7) s: abc
      12:09:23,642 INFO  [stdout] (default task-7) getS(): count: 2
      12:09:23,642 INFO  [stdout] (default task-7) s: abc
      status: 200
      
      java.lang.AssertionError
      	at org.junit.Assert.fail(Assert.java:86)
      	at org.junit.Assert.assertTrue(Assert.java:41)
      	at org.junit.Assert.assertNotNull(Assert.java:621)
      	at org.junit.Assert.assertNotNull(Assert.java:631)
      	at org.jboss.resteasy.test.validation.TestGetterReturnValueValidated.testReturnValues(TestGetterReturnValueValidated.java:52)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
      	at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      

      Expected results:
      No errors in tests

              rsigal@redhat.com Ronald Sigal
              mkopecky@redhat.com Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: