You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michele Vivoda (JIRA)" <ji...@apache.org> on 2014/02/04 01:07:06 UTC

[jira] [Created] (JXPATH-165) Test order and JXPathContextReferenceImpl.removeNodePointerFactory

Michele Vivoda created JXPATH-165:
-------------------------------------

             Summary: Test order and JXPathContextReferenceImpl.removeNodePointerFactory
                 Key: JXPATH-165
                 URL: https://issues.apache.org/jira/browse/JXPATH-165
             Project: Commons JXPath
          Issue Type: Improvement
            Reporter: Michele Vivoda
            Priority: Minor


Running the test folder with Eclipse 'run as junit test' one JXPath test failed: {{LazyDynaBeanTest.testLazyProperty()}}. The test does not fail when run in isolation.   This happens because there is an other test {{testStrictLazyDynaBeanPropertyFactory()}} in the same file that registers a {{StrictLazyDynaBeanPointerFactory}}, if the test order is not source order then test fails. 

Splitting in two test files does not help, still order dependent. 

For this reason I suggest to create a new {{removeNodePointerFactory}} method in {{JXPathContextReferenceImpl}}  that could be used in a finally block to restore the initial environment. 

Implementation should be straightforward observing the existing code of {{addNodePointerFactory}}:
{noformat}
      public static void removeNodePointerFactory(NodePointerFactory factory) {
        synchronized (nodeFactories) {
            nodeFactories.remove(factory);
            nodeFactoryArray = null;
        }
    }
{noformat}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)