[arquillian-issues] [JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly

Lukáš Fryč (JIRA) issues at jboss.org
Thu Apr 24 08:12:34 EDT 2014


    [ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12963482#comment-12963482 ] 

Lukáš Fryč edited comment on ARQGRA-433 at 4/24/14 8:12 AM:
------------------------------------------------------------

The purpose of this validator is that people that use public fields,

1) don't actually see a state of a bean (e.g. page fragment), but rather a state of a proxy (which isn't enriched and their state thus doesn't have to correspond)
2) can't use interceptors because field access (as opposed to method accessor) can't be intercepted

Graphene can't auto-magically synchronize state of a proxy and its bean.

----

But if I understand it correctly, in the case above, Graphene checks the @Rule field that is actually part of test case, right?

This is not correct as the test case IS NOT a bean instantiated by Graphene.
                
      was (Author: lfryc):
    The purpose of this validator is that people that use public fields,

1) don't actually see a state of a bean (e.g. page fragment), but rather a state of a proxy (which isn't enriched and their state thus doesn't have to correspond)
2) can't use interceptors because field access (as opposed to method accessor) can't be intercepted

Graphene can't auto-magically synchronize state of a proxy and its bean.

----

But if I understand it correctly, Graphene checks the @Rule field that is actually part of test case, right?

This is not correct as the test case IS NOT a bean instantiated by Graphene.
                  
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
>                 Key: ARQGRA-433
>                 URL: https://issues.jboss.org/browse/ARQGRA-433
>             Project: Arquillian Graphene
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.0.2.Final
>            Reporter: Stefan Miklosovic
>            Priority: Optional
>
> I have this test
> {code}
>     @Rule
>     public ExpectedException expectedException = ExpectedException.none();
>     @Test
>     @InSequence(2)
>     @ReportMessage("This method should pass.")
>     public void testWithExpectedExceptionRule() {
>         expectedException.expect(RuntimeException.class);
>         throw new RuntimeException("this exception is expected");
>     }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case  validation does not make sense.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the arquillian-issues mailing list