    1   /*
    2    * Copyright 1999-2004 The Apache Software Foundation
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *     http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  package org.apache.commons.jxpath.ri.model.beans;
    17
    18  import junit.framework.TestSuite;
    19
    20  import org.apache.commons.jxpath.AbstractFactory;
    21  import org.apache.commons.jxpath.JXPathContext;
    22  import org.apache.commons.jxpath.TestBean;
    23  import org.apache.commons.jxpath.ri.model.BeanModelTestCase;
    24
    25  /***
    26   * Tests JXPath with JavaBeans
    27  *
    28   * @author Dmitri Plotnikov
    29   * @version $Revision: 1.7 $ $Date: 2004/02/29 14:17:43 $
    30   */
    31
    32  public class BeanModelTest extends BeanModelTestCase {
    33      /***
    34       * Construct a new instance of this test case.
    35       *
    36       * @param name Name of the test case
    37       */
    38      public BeanModelTest(String name) {
    39          super(name);
    40      }
    41
    42      /***
    43       * Return the tests included in this test suite.
    44       */
    45      public static TestSuite suite() {
    46          return (new TestSuite(BeanModelTest.class));
    47      }
    48
    49      protected Object createContextBean() {
    50          return new TestBean();
    51      }
    52
    53      protected AbstractFactory getAbstractFactory() {
    54          return new TestBeanFactory();
    55      }
    56
    57      public void testIndexedProperty() {
    58          JXPathContext context =
    59              JXPathContext.newContext(null, new TestIndexedPropertyBean());
    60
    61          assertXPathValueAndPointer(
    62              context,
    63              "indexed[1]",
    64              new Integer(0),
    65              "/indexed[1]");
    66      }
    67
    68
    69  }