Home | History | Annotate | Download | only in core
      1 
      2 /*
      3 This Java source file was generated by test-to-java.xsl
      4 and is a derived work from the source document.
      5 The source document contained the following notice:
      6 
      7 
      8 
      9 
     10 
     11 Copyright (c) 2001 World Wide Web Consortium,
     12 
     13 (Massachusetts Institute of Technology, Institut National de
     14 
     15 Recherche en Informatique et en Automatique, Keio University).  All
     16 
     17 Rights Reserved.  This program is distributed under the W3C's Software
     18 
     19 Intellectual Property License.  This program is distributed in the
     20 
     21 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     22 
     23 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     24 
     25 PURPOSE.
     26 
     27 
     28 
     29 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     30 
     31 
     32 
     33 
     34 */
     35 
     36 package org.w3c.domts.level2.core;
     37 
     38 import org.w3c.dom.*;
     39 
     40 
     41 import org.w3c.domts.DOMTestCase;
     42 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     43 
     44 
     45 
     46 /**
     47  *       The method hasAttribute returns true when an attribute with a given name is specified
     48  *       on this element or has a default value, false otherwise
     49  *       Invoke the hasAttribute method to check if the documentElement has attributres.
     50  *
     51 * @author IBM
     52 * @author Neil Delima
     53 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
     54 */
     55 public final class elementhasattribute01 extends DOMTestCase {
     56 
     57    /**
     58     * Constructor.
     59     * @param factory document factory, may not be null
     60     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     61     */
     62    public elementhasattribute01(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     63 
     64       org.w3c.domts.DocumentBuilderSetting[] settings =
     65           new org.w3c.domts.DocumentBuilderSetting[] {
     66 org.w3c.domts.DocumentBuilderSetting.notNamespaceAware
     67         };
     68         DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
     69         setFactory(testFactory);
     70 
     71     //
     72     //   check if loaded documents are supported for content type
     73     //
     74     String contentType = getContentType();
     75     preload(contentType, "staff", false);
     76     }
     77 
     78    /**
     79     * Runs the test case.
     80     * @throws Throwable Any uncaught exception causes test to fail
     81     */
     82    public void runTest() throws Throwable {
     83       Document doc;
     84       Element element;
     85       boolean state;
     86       doc = (Document) load("staff", false);
     87       element = doc.getDocumentElement();
     88       state = element.hasAttribute("");
     89       assertFalse("elementhasattribute01", state);
     90 }
     91    /**
     92     *  Gets URI that identifies the test.
     93     *  @return uri identifier of test
     94     */
     95    public String getTargetURI() {
     96       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01";
     97    }
     98    /**
     99     * Runs this test from the command line.
    100     * @param args command line arguments
    101     */
    102    public static void main(final String[] args) {
    103         DOMTestCase.doMain(elementhasattribute01.class, args);
    104    }
    105 }
    106 
    107