@@ -0,0 +1,2505 @@
+/*%0D%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0D%0A * contributor license agreements.  See the NOTICE file distributed with%0D%0A * this work for additional information regarding copyright ownership.%0D%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0D%0A * (the %22License%22); you may not use this file except in compliance with%0D%0A * the License.  You may obtain a copy of the License at%0D%0A *%0D%0A *     http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0Apackage org.apache.commons.jxpath.ri;%0D%0A%0D%0Aimport java.util.Iterator;%0D%0Aimport junit.framework.Assert;%0D%0Aimport junit.framework.TestCase;%0D%0Aimport org.apache.commons.jxpath.JXPathContext;%0D%0Aimport org.apache.commons.jxpath.Pointer;%0D%0A%0D%0A/**%0D%0A * Testcase proving JXPATH-118 issue with asPath() returning wrong names.%0D%0A *%0D%0A * @author Mike Haller%0D%0A * @author Michele Vivoda modified for pre annotations Java, reordered fields, in my version no failures in JDK1.4%0D%0A */%0D%0Apublic class JXPath118Test extends TestCase%0D%0A%7B%0D%0A%0D%0A    public void testJXPATH118IssueWithAsPath() throws Exception%0D%0A    %7B%0D%0A        Object contextBean = new SomeChildClass();%0D%0A        JXPathContext context = JXPathContext.newContext(contextBean);%0D%0A        Iterator iteratePointers = context.iteratePointers(%22//*%22);%0D%0A        Assert.assertEquals(%22/bar%22, ((Pointer) iteratePointers.next()).asPath());%0D%0A        Assert.assertEquals(%22/baz%22, ((Pointer) iteratePointers.next()).asPath());%0D%0A        Assert.assertEquals(%22/foo%22, ((Pointer) iteratePointers.next()).asPath());%0D%0A    %7D%0D%0A%0D%0A    public static class SomeChildClass%0D%0A    %7B%0D%0A%0D%0A        private int foo = 1;%0D%0A        private int bar = 2;%0D%0A        private int baz = 3;%0D%0A%0D%0A        public int getFoo()%0D%0A        %7B%0D%0A            return foo;%0D%0A        %7D%0D%0A%0D%0A        public void setFoo(int foo)%0D%0A        %7B%0D%0A            this.foo = foo;%0D%0A        %7D%0D%0A%0D%0A        public int getBar()%0D%0A        %7B%0D%0A            return bar;%0D%0A        %7D%0D%0A%0D%0A        public void setBar(int bar)%0D%0A        %7B%0D%0A            this.bar = bar;%0D%0A        %7D%0D%0A%0D%0A        public int getBaz()%0D%0A        %7B%0D%0A            return baz;%0D%0A        %7D%0D%0A%0D%0A        public void setBaz(int baz)%0D%0A        %7B%0D%0A            this.baz = baz;%0D%0A        %7D%0D%0A%0D%0A    %7D%0D%0A%0D%0A%7D%0D%0A

Add test proofing that JXPATH-118 is not a problem with the current trunk. Thanks to Mike Haller, Michele Vivoda and Uwe Barthel. This also fixes #7 from github.