Clover coverage report - Clover results for XOM 1.2d1
Coverage timestamp: Wed Feb 8 2006 08:31:33 EST
file stats: LOC: 125   Methods: 4
NCLOC: 84   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AttributeTypeTest.java - 100% 100% 100%
coverage
 1    /* Copyright 2003 Elliotte Rusty Harold
 2   
 3    This library is free software; you can redistribute it and/or modify
 4    it under the terms of version 2.1 of the GNU Lesser General Public
 5    License as published by the Free Software Foundation.
 6   
 7    This library is distributed in the hope that it will be useful,
 8    but WITHOUT ANY WARRANTY; without even the implied warranty of
 9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 10    GNU Lesser General Public License for more details.
 11   
 12    You should have received a copy of the GNU Lesser General Public
 13    License along with this library; if not, write to the
 14    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 15    Boston, MA 02111-1307 USA
 16   
 17    You can contact Elliotte Rusty Harold by sending e-mail to
 18    elharo@metalab.unc.edu. Please include the word "XOM" in the
 19    subject line. The XOM home page is located at http://www.xom.nu/
 20    */
 21    package nu.xom.tests;
 22   
 23    import nu.xom.Attribute;
 24    import nu.xom.Text;
 25   
 26    /**
 27    * <p>
 28    * Tests for the <code>Attribute.Type</code> inner class.
 29    * </p>
 30    *
 31    * @author Elliotte Rusty Harold
 32    * @version 1.0
 33    *
 34    */
 35    public class AttributeTypeTest extends XOMTestCase {
 36   
 37  3 public AttributeTypeTest(String name) {
 38  3 super(name);
 39    }
 40   
 41  1 public void testEquals() {
 42  1 assertEquals(Attribute.Type.CDATA, Attribute.Type.CDATA);
 43  1 assertEquals(Attribute.Type.ID, Attribute.Type.ID);
 44  1 assertEquals(Attribute.Type.IDREF, Attribute.Type.IDREF);
 45  1 assertEquals(Attribute.Type.IDREFS, Attribute.Type.IDREFS);
 46  1 assertEquals(Attribute.Type.UNDECLARED, Attribute.Type.UNDECLARED);
 47  1 assertEquals(Attribute.Type.NMTOKEN, Attribute.Type.NMTOKEN);
 48  1 assertEquals(Attribute.Type.NMTOKENS, Attribute.Type.NMTOKENS);
 49  1 assertEquals(Attribute.Type.NOTATION, Attribute.Type.NOTATION);
 50  1 assertEquals(Attribute.Type.ENTITY, Attribute.Type.ENTITY);
 51  1 assertEquals(Attribute.Type.ENTITIES, Attribute.Type.ENTITIES);
 52  1 assertTrue(Attribute.Type.ENTITIES != Attribute.Type.ENTITY);
 53  1 assertTrue(Attribute.Type.CDATA != Attribute.Type.ID);
 54  1 assertTrue(Attribute.Type.ID != Attribute.Type.IDREF);
 55  1 assertTrue(Attribute.Type.ID != Attribute.Type.IDREFS);
 56  1 assertTrue(Attribute.Type.ID != Attribute.Type.NMTOKEN);
 57  1 assertTrue(Attribute.Type.ID != Attribute.Type.NMTOKENS);
 58  1 assertTrue(Attribute.Type.UNDECLARED != Attribute.Type.CDATA);
 59  1 assertTrue(Attribute.Type.NMTOKEN != Attribute.Type.CDATA);
 60   
 61  1 assertFalse(Attribute.Type.CDATA.equals(new Integer(1)));
 62  1 assertFalse(Attribute.Type.CDATA.equals(new Text("data")));
 63    }
 64   
 65  1 public void testToString() {
 66  1 assertNotNull(Attribute.Type.CDATA.toString());
 67  1 assertNotNull(Attribute.Type.ID.toString());
 68  1 assertNotNull(Attribute.Type.IDREF.toString());
 69  1 assertNotNull(Attribute.Type.IDREFS.toString());
 70  1 assertNotNull(Attribute.Type.UNDECLARED.toString());
 71  1 assertNotNull(Attribute.Type.NMTOKEN.toString());
 72  1 assertNotNull(Attribute.Type.NMTOKENS.toString());
 73  1 assertNotNull(Attribute.Type.NOTATION.toString());
 74  1 assertNotNull(Attribute.Type.ENTITY.toString());
 75  1 assertNotNull(Attribute.Type.ENTITIES.toString());
 76   
 77  1 assertTrue(Attribute.Type.CDATA.toString().length() > 10);
 78  1 assertTrue(Attribute.Type.ID.toString().length() > 10);
 79  1 assertTrue(Attribute.Type.IDREF.toString().length() > 10);
 80  1 assertTrue(Attribute.Type.IDREFS.toString().length() > 10);
 81  1 assertTrue(Attribute.Type.UNDECLARED.toString().length() > 10);
 82  1 assertTrue(Attribute.Type.NMTOKEN.toString().length() > 10);
 83  1 assertTrue(Attribute.Type.NMTOKENS.toString().length() > 10);
 84  1 assertTrue(Attribute.Type.NOTATION.toString().length() > 10);
 85  1 assertTrue(Attribute.Type.ENTITY.toString().length() > 10);
 86  1 assertTrue(Attribute.Type.ENTITIES.toString().length() > 10);
 87   
 88  1 assertTrue(Attribute.Type.CDATA.toString().startsWith("[Attribute.Type"));
 89  1 assertTrue(Attribute.Type.ID.toString().startsWith("[Attribute.Type"));
 90  1 assertTrue(Attribute.Type.IDREF.toString().startsWith("[Attribute.Type"));
 91  1 assertTrue(Attribute.Type.IDREFS.toString().startsWith("[Attribute.Type"));
 92  1 assertTrue(Attribute.Type.UNDECLARED.toString().startsWith("[Attribute.Type"));
 93  1 assertTrue(Attribute.Type.NMTOKEN.toString().startsWith("[Attribute.Type"));
 94  1 assertTrue(Attribute.Type.NMTOKENS.toString().startsWith("[Attribute.Type"));
 95  1 assertTrue(Attribute.Type.NOTATION.toString().startsWith("[Attribute.Type"));
 96  1 assertTrue(Attribute.Type.ENTITY.toString().startsWith("[Attribute.Type"));
 97  1 assertTrue(Attribute.Type.ENTITIES.toString().startsWith("[Attribute.Type"));
 98   
 99  1 assertTrue(Attribute.Type.CDATA.toString().endsWith("]"));
 100  1 assertTrue(Attribute.Type.ID.toString().endsWith("]"));
 101  1 assertTrue(Attribute.Type.IDREF.toString().endsWith("]"));
 102  1 assertTrue(Attribute.Type.IDREFS.toString().endsWith("]"));
 103  1 assertTrue(Attribute.Type.UNDECLARED.toString().endsWith("]"));
 104  1 assertTrue(Attribute.Type.NMTOKEN.toString().endsWith("]"));
 105  1 assertTrue(Attribute.Type.NMTOKENS.toString().endsWith("]"));
 106  1 assertTrue(Attribute.Type.NOTATION.toString().endsWith("]"));
 107  1 assertTrue(Attribute.Type.ENTITY.toString().endsWith("]"));
 108  1 assertTrue(Attribute.Type.ENTITIES.toString().endsWith("]"));
 109   
 110    }
 111   
 112  1 public void testGetName() {
 113  1 assertEquals("ENUMERATION", Attribute.Type.ENUMERATION.getName());
 114  1 assertEquals("NOTATION", Attribute.Type.NOTATION.getName());
 115  1 assertEquals("ENTITY", Attribute.Type.ENTITY.getName());
 116  1 assertEquals("ENTITIES", Attribute.Type.ENTITIES.getName());
 117  1 assertEquals("CDATA", Attribute.Type.CDATA.getName());
 118  1 assertEquals("ID", Attribute.Type.ID.getName());
 119  1 assertEquals("IDREF", Attribute.Type.IDREF.getName());
 120  1 assertEquals("IDREFS", Attribute.Type.IDREFS.getName());
 121  1 assertEquals("NMTOKEN", Attribute.Type.NMTOKEN.getName());
 122  1 assertEquals("NMTOKENS", Attribute.Type.NMTOKENS.getName());
 123    }
 124   
 125    }