Java Code Examples for com.helger.commons.mock.CommonsTestHelper#testToStringImplementation()

The following examples show how to use com.helger.commons.mock.CommonsTestHelper#testToStringImplementation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WrappedWriterTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testAll () throws IOException
{
  final NonBlockingStringWriter aSW = new NonBlockingStringWriter ();
  try (final WrappedWriter ws = new WrappedWriter (aSW))
  {
    ws.write ('a');
    ws.write ("bc".toCharArray ());
    ws.write ("de".toCharArray (), 0, 1);
    ws.write ("ef");
    ws.write ("fgh", 1, 1);
    assertEquals ("abcdefg", aSW.getAsString ());
    ws.append ('0').append ("12").append ("234", 1, 2);
    assertEquals ("abcdefg0123", aSW.getAsString ());
    ws.flush ();
    CommonsTestHelper.testToStringImplementation (ws);
  }

  try (final WrappedWriter ws = new WrappedWriter (null))
  {
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
Example 2
Source File: WrappedOutputStreamTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings ("resource")
@Test
public void testAll () throws IOException
{
  final NonBlockingByteArrayOutputStream baos = new NonBlockingByteArrayOutputStream ();
  try (final WrappedOutputStream ws = new WrappedOutputStream (baos))
  {
    ws.write ('a');
    ws.write ("bc".getBytes (StandardCharsets.ISO_8859_1));
    ws.write ("cde".getBytes (StandardCharsets.ISO_8859_1), 1, 1);
    ws.flush ();
    assertEquals ("abcd", baos.getAsString (StandardCharsets.ISO_8859_1));
    CommonsTestHelper.testToStringImplementation (ws);
  }

  try
  {
    new WrappedOutputStream (null).close ();
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
Example 3
Source File: LoggingTransformErrorListenerTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testAll ()
{
  final LoggingTransformErrorListener el = new LoggingTransformErrorListener (L_EN);
  final TransformerFactory fac = XMLTransformerFactory.createTransformerFactory (el,
                                                                                 new LoggingTransformURIResolver ());
  assertNotNull (fac);

  // Read valid XSLT
  Templates t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test1.xslt"));
  assertNotNull (t1);

  // Read valid XSLT (with import)
  t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test2.xslt"));
  assertNotNull (t1);

  // Read invalid XSLT
  assertNull (XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("test1.txt")));

  CommonsTestHelper.testToStringImplementation (el);
}
 
Example 4
Source File: PSXPathBoundSchemaTest.java    From ph-schematron with Apache License 2.0 6 votes vote down vote up
@Test
public void testBindAllValidSchematrons () throws SchematronException
{
  for (final IReadableResource aRes : SchematronTestHelper.getAllValidSchematronFiles ())
  {
    // Parse the schema
    final PSSchema aSchema = new PSReader (aRes).readSchema ();
    assertNotNull (aSchema);
    CommonsTestHelper.testToStringImplementation (aSchema);

    final CollectingPSErrorHandler aLogger = new CollectingPSErrorHandler ();
    assertTrue (aRes.getPath (), aSchema.isValid (aLogger));
    assertTrue (aLogger.isEmpty ());

    // Create a compiled schema
    final IPSBoundSchema aBoundSchema = PSXPathQueryBinding.getInstance ().bind (aSchema);
    assertNotNull (aBoundSchema);
  }
}
 
Example 5
Source File: BasicThreadFactoryTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressFBWarnings (value = "DLS_DEAD_LOCAL_STORE")
public void testAll ()
{
  final BasicThreadFactory x = new BasicThreadFactory.Builder ().setDaemon (false)
                                                                .setPriority (Thread.NORM_PRIORITY)
                                                                .setNamingPattern ("pool %d")
                                                                .build ();
  for (int i = 0; i < 2; ++i)
  {
    final Thread t = x.newThread ( () -> {
      // nada
      if (false)
        LOGGER.info ("In thread '" + Thread.currentThread ().getName () + "'");
    });
    assertNotNull (t);
    t.start ();
  }
  CommonsTestHelper.testToStringImplementation (x);
}
 
Example 6
Source File: ResourceStreamSourceTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testBasic ()
{
  final IReadableResource aRes = new ClassPathResource ("xml/test1.xslt");
  assertTrue (aRes.exists ());
  final ResourceStreamSource src = new ResourceStreamSource (aRes);
  final InputStream is = src.getInputStream ();
  assertNotNull (is);
  StreamHelper.close (is);
  assertEquals (aRes.getResourceID (), src.getSystemId ());
  assertNull (src.getPublicId ());

  CommonsTestHelper.testToStringImplementation (src);
}
 
Example 7
Source File: StringSAXInputSourceTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testBasic ()
{
  final StringSAXInputSource sis = new StringSAXInputSource ("bla foo 90");
  assertEquals ("bla foo 90", StreamHelper.getAllCharactersAsString (sis.getCharacterStream ()));
  CommonsTestHelper.testToStringImplementation (sis);
}
 
Example 8
Source File: FileOperationManagerTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testCtor ()
{
  final IFileOperationManager aFOM = new FileOperationManager ();
  assertNull (aFOM.getLastError ());
  assertNull (aFOM.getLastOperation ());
  CommonsTestHelper.testToStringImplementation (aFOM);
}
 
Example 9
Source File: ReadableResourceSAXInputSourceTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testBasic ()
{
  final IReadableResource aRes = new ClassPathResource ("xml/list.xml");
  final ReadableResourceSAXInputSource is = new ReadableResourceSAXInputSource (aRes);
  assertNotNull (StreamHelper.getAllBytes (is.getByteStream ()));
  CommonsTestHelper.testToStringImplementation (is);

  assertNull (new ReadableResourceSAXInputSource (new MockNullInputStreamProvider (), "sysid").getByteStream ());
}
 
Example 10
Source File: MicroEntityReferenceTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testCreation ()
{
  IMicroEntityReference e = new MicroEntityReference ("xyz");
  assertNotNull (e);
  assertEquals ("xyz", e.getName ());
  assertFalse (e.hasParent ());
  assertFalse (e.hasChildren ());
  assertNull (e.getAllChildren ());
  assertNull (e.getFirstChild ());
  assertNull (e.getLastChild ());
  assertNull (e.getChildAtIndex (0));
  assertNull (e.getAllChildrenRecursive ());
  assertEquals (0, e.getChildCount ());
  assertNotNull (e.getNodeName ());
  assertNotNull (e.getNodeValue ());
  assertSame (EMicroNodeType.ENTITY_REFERENCE, e.getType ());
  CommonsTestHelper.testToStringImplementation (e);

  assertTrue (e.isEqualContent (e));
  assertFalse (e.isEqualContent (null));
  assertFalse (e.isEqualContent (new MicroDocument ()));

  e = new MicroEntityReference ("xyz");
  assertTrue (e.isEqualContent (e.getClone ()));

  assertTrue (new MicroEntityReference ("xyz").isEqualContent (new MicroEntityReference ("xyz")));
  assertFalse (new MicroEntityReference ("xyz").isEqualContent (new MicroEntityReference ("xy")));
}
 
Example 11
Source File: IterableIteratorTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testBasic ()
{
  assertSame (IterableIterator.createEmpty (), IterableIterator.createEmpty ());
  IIterableIterator <String> iit = new IterableIterator <> (ArrayHelper.newArray ("Hallo",
                                                                                  "Welt",
                                                                                  "from",
                                                                                  "Copenhagen"));
  assertNotNull (iit);
  assertNotNull (iit.iterator ());
  assertTrue (iit.hasNext ());
  assertEquals ("Hallo", iit.next ());

  iit = new IterableIterator <> (CollectionHelper.newList ("Hallo", "Welt", "from", "Copenhagen"));
  iit.next ();
  iit.remove ();

  assertEquals (3, CollectionHelper.newList (new IterableIterator <> (new String [] { "a", "b", "c" })).size ());
  assertEquals (3,
                CollectionHelper.newList (new IterableIterator <> (CollectionHelper.newList ("a", "b", "c")))
                                .size ());
  assertEquals (3,
                CollectionHelper.newList (new IterableIterator <> (CollectionHelper.newList ("a", "b", "c")
                                                                                   .iterator ()))
                                .size ());
  CommonsTestHelper.testToStringImplementation (iit);

  try
  {
    new IterableIterator <> ((Iterator <String>) null);
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
Example 12
Source File: LoggingLSResourceResolverTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefault ()
{
  LoggingLSResourceResolver lrr = new LoggingLSResourceResolver ();
  lrr.resolveResource ("xsd", "nsuri", null, "sysid", "baseURI");

  CommonsTestHelper.testToStringImplementation (lrr);

  lrr = new LoggingLSResourceResolver ();
  lrr.setWrappedResourceResolver (new LoggingLSResourceResolver ());
  lrr.resolveResource ("xsd", "nsuri", null, "sysid", "baseURI");
}
 
Example 13
Source File: WrappedInputStreamTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings ("resource")
@Test
public void testAll () throws IOException
{
  final NonBlockingByteArrayInputStream baos = new NonBlockingByteArrayInputStream (new byte [100]);
  final WrappedInputStream ws = new WrappedInputStream (baos);
  assertTrue (ws.markSupported ());
  assertEquals (100, ws.available ());
  ws.mark (0);
  ws.read ();
  ws.read (new byte [4]);
  ws.read (new byte [5], 1, 1);
  ws.skip (4);
  assertEquals (90, ws.available ());
  ws.reset ();
  assertEquals (100, ws.available ());
  ws.close ();
  CommonsTestHelper.testToStringImplementation (ws);

  try
  {
    new WrappedInputStream (null).close ();
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
Example 14
Source File: FormatterStringSkipPrefixAndSuffixTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testAll ()
{
  final FormatterStringSkipPrefixAndSuffix fp = new FormatterStringSkipPrefixAndSuffix ("a", "o");
  assertEquals ("bc", fp.apply ("abco"));
  assertEquals ("bc", fp.apply ("abc"));
  assertEquals ("bc", fp.apply ("bco"));
  assertEquals ("bc", fp.apply ("bc"));
  CommonsTestHelper.testToStringImplementation (fp);
}
 
Example 15
Source File: IComparatorTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testCollating ()
{
  final List <String> l = CollectionHelper.newList ("a", null, "c");
  assertEquals (3, CollectionHelper.getSorted (l, IComparator.getComparatorCollating (Locale.US)).size ());
  assertEquals (3,
                CollectionHelper.getSorted (l, IComparator.getComparatorCollating (Locale.US).reversed ()).size ());
  assertEquals (3, CollectionHelper.getSorted (l, IComparator.getComparatorCollating (L_EN)).size ());
  assertEquals (3, CollectionHelper.getSorted (l, IComparator.getComparatorCollating (L_FR).reversed ()).size ());
  assertEquals (3,
                CollectionHelper.getSorted (l, IComparator.getComparatorCollating (Collator.getInstance (L_FR)))
                                .size ());
  assertEquals (3,
                CollectionHelper.getSorted (l,
                                            IComparator.getComparatorCollating (Collator.getInstance (L_FR))
                                                       .reversed ())
                                .size ());
  CommonsTestHelper.testToStringImplementation (IComparator.getComparatorCollating (Locale.US));

  try
  {
    IComparator.getComparatorCollating ((Collator) null);
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
Example 16
Source File: CountingFileInputStreamTest.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Test
public void testAll () throws IOException
{
  CountingFileInputStream aCIS = new CountingFileInputStream ("pom.xml");
  try
  {
    aCIS.read ();
    assertEquals (1, aCIS.read (new byte [5], 1, 1));
    StreamHelper.copyInputStreamToOutputStream (aCIS, new NonBlockingByteArrayOutputStream ());
    CommonsTestHelper.testToStringImplementation (aCIS);
  }
  finally
  {
    StreamHelper.close (aCIS);
  }

  aCIS = new CountingFileInputStream (new File ("pom.xml"));
  try
  {
    aCIS.read ();
    assertEquals (1, aCIS.read (new byte [5], 1, 1));
    StreamHelper.copyInputStreamToOutputStream (aCIS, new NonBlockingByteArrayOutputStream ());
    CommonsTestHelper.testToStringImplementation (aCIS);
  }
  finally
  {
    StreamHelper.close (aCIS);
  }
}
 
Example 17
Source File: MicroCDATATest.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreation ()
{
  assertNotNull (new MicroCDATA (null));
  assertNotNull (new MicroCDATA (""));

  IMicroCDATA e = new MicroCDATA ("xyz");
  assertNotNull (e);
  assertEquals ("xyz", e.getData ().toString ());
  assertFalse (e.hasParent ());
  assertFalse (e.hasChildren ());
  assertNull (e.getAllChildren ());
  assertNull (e.getFirstChild ());
  assertNull (e.getLastChild ());
  assertNull (e.getChildAtIndex (0));
  assertNull (e.getAllChildrenRecursive ());
  assertEquals (0, e.getChildCount ());
  assertNotNull (e.getNodeName ());
  assertNotNull (e.getNodeValue ());
  assertSame (EMicroNodeType.CDATA, e.getType ());
  CommonsTestHelper.testToStringImplementation (e);

  e.setData ("allo");
  assertEquals ("allo", e.getData ().toString ());
  assertFalse (e.hasChildren ());
  assertNull (e.getAllChildren ());

  e.appendData (" Welt");
  assertEquals ("allo Welt", e.getData ().toString ());

  e.prependData ("H");
  assertEquals ("Hallo Welt", e.getData ().toString ());

  e = new MicroCDATA ("xyz");
  assertNotNull (e);
  assertTrue (e.isEqualContent (e.getClone ()));
  e = new MicroCDATA (null);
  assertNotNull (e);
  assertTrue (e.isEqualContent (e.getClone ()));

  assertTrue (e.isEqualContent (e));
  assertFalse (e.isEqualContent (null));
  assertFalse (e.isEqualContent (new MicroDocument ()));

  assertTrue (new MicroCDATA ("xyz").isEqualContent (new MicroCDATA ("xyz")));
  assertFalse (new MicroCDATA ("xyz").isEqualContent (new MicroCDATA ("xy")));
}
 
Example 18
Source File: MicroTextTest.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreation ()
{
  assertNotNull (new MicroText (null));
  assertNotNull (new MicroText (""));

  IMicroText e = new MicroText ("xyz");
  assertNotNull (e);
  assertEquals ("xyz", e.getData ().toString ());
  assertFalse (e.hasParent ());
  assertFalse (e.hasChildren ());
  assertNull (e.getAllChildren ());
  assertNull (e.getFirstChild ());
  assertNull (e.getLastChild ());
  assertNull (e.getChildAtIndex (0));
  assertNull (e.getAllChildrenRecursive ());
  assertEquals (0, e.getChildCount ());
  assertNotNull (e.getNodeName ());
  assertNotNull (e.getNodeValue ());
  assertSame (EMicroNodeType.TEXT, e.getType ());
  CommonsTestHelper.testToStringImplementation (e);

  e.setData ("allo");
  assertEquals ("allo", e.getData ().toString ());
  assertFalse (e.hasChildren ());
  assertNull (e.getAllChildren ());

  e.appendData (" Welt");
  assertEquals ("allo Welt", e.getData ().toString ());

  e.prependData ("H");
  assertEquals ("Hallo Welt", e.getData ().toString ());

  e = new MicroText ("xyz");
  assertNotNull (e);
  assertTrue (e.isEqualContent (e.getClone ()));
  e = new MicroText (null);
  assertNotNull (e);
  assertTrue (e.isEqualContent (e.getClone ()));

  assertTrue (e.isEqualContent (e));
  assertFalse (e.isEqualContent (null));
  assertFalse (e.isEqualContent (new MicroDocument ()));

  assertTrue (new MicroText ("xyz").isEqualContent (new MicroText ("xyz")));
  assertFalse (new MicroText ("xyz").isEqualContent (new MicroText ("xy")));
}
 
Example 19
Source File: MicroElementTest.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetChildElements ()
{
  IMicroElement eRoot = new MicroElement ("root");
  assertNotNull (eRoot.getAllChildElements ());
  assertTrue (eRoot.getAllChildElements ().isEmpty ());
  assertFalse (eRoot.hasChildElements ());
  CommonsTestHelper.testToStringImplementation (eRoot);

  final IMicroElement e1 = eRoot.appendElement ("level1");
  e1.appendElement ("e11");
  eRoot.appendText ("My text node");
  eRoot.appendComment ("Comment");
  eRoot.appendElement ("xyz");
  CommonsTestHelper.testToStringImplementation (eRoot);

  assertNotNull (eRoot.getAllChildElements ());
  assertEquals (2, eRoot.getAllChildElements ().size ());
  assertEquals (e1, eRoot.getFirstChild ());
  assertEquals (e1, eRoot.getFirstChildElement ());
  assertNull (eRoot.getFirstChildElement ("anyothername"));
  assertTrue (eRoot.hasChildElements ());
  assertTrue (eRoot.hasChildElements ("level1"));
  assertFalse (eRoot.hasChildElements ("level2"));

  final IMicroContainer ec = eRoot.appendContainer ();
  assertEquals (2, eRoot.getAllChildElements ().size ());
  assertEquals (1, eRoot.getAllChildElements ("level1").size ());
  final IMicroElement e2a = ec.appendElement ("level2a");
  e2a.appendElement ("e2a1");
  e2a.appendComment ("any");
  e2a.appendElement ("e2a2");
  final IMicroElement e2b = ec.appendElement ("level2b");
  e2b.appendElement ("e2b1");
  e2b.appendComment ("any");
  e2b.appendElement ("e2b2");
  assertEquals (4, eRoot.getAllChildElements ().size ());
  assertEquals (1, eRoot.getAllChildElements ("level1").size ());
  assertTrue (eRoot.hasChildElements ("level2a"));
  assertEquals (1, eRoot.getAllChildElements ("level2a").size ());
  assertFalse (eRoot.hasChildElements ("level2c"));
  assertNotNull (eRoot.getFirstChildElement ("level1"));
  assertNotNull (eRoot.getFirstChildElement ("level2a"));

  // special (element -> container)
  eRoot = new MicroElement ("root");
  assertNull (eRoot.getFirstChildElement ());
  IMicroContainer aCont = eRoot.appendContainer ();
  assertTrue (eRoot.hasChildren ());
  assertFalse (eRoot.hasChildElements ());
  assertNull (eRoot.getFirstChildElement ());
  aCont.appendElement ("el");
  assertTrue (eRoot.hasChildren ());
  assertTrue (eRoot.hasChildElements ());
  assertNotNull (eRoot.getFirstChildElement ());

  // special (element -> container -> container)
  eRoot = new MicroElement ("root");
  assertNull (eRoot.getFirstChildElement ());
  aCont = eRoot.appendContainer ();
  assertTrue (eRoot.hasChildren ());
  assertFalse (eRoot.hasChildElements ());
  assertNull (eRoot.getFirstChildElement ());
  final IMicroContainer aCont2 = aCont.appendContainer ();
  aCont2.appendElement ("el");
  assertTrue (eRoot.hasChildren ());
  assertTrue (eRoot.hasChildElements ());
  assertNotNull (eRoot.getFirstChildElement ());
}
 
Example 20
Source File: MapBasedNamespaceContextTest.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
@Test
public void testAll ()
{
  final MapBasedNamespaceContext c = new MapBasedNamespaceContext ();
  assertNull (c.getDefaultNamespaceURI ());
  assertNotNull (c.getPrefixes ("http://1"));
  assertFalse (c.getPrefixes ("http://1").hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XML_NS_URI).hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XMLNS_ATTRIBUTE_NS_URI).hasNext ());

  assertNull (c.getPrefix ("http://1"));
  assertEquals (XMLConstants.XML_NS_PREFIX, c.getPrefix (XMLConstants.XML_NS_URI));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE, c.getPrefix (XMLConstants.XMLNS_ATTRIBUTE_NS_URI));

  assertEquals (XMLConstants.NULL_NS_URI, c.getNamespaceURI (XMLConstants.DEFAULT_NS_PREFIX));
  assertEquals (XMLConstants.XML_NS_URI, c.getNamespaceURI (XMLConstants.XML_NS_PREFIX));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE_NS_URI, c.getNamespaceURI (XMLConstants.XMLNS_ATTRIBUTE));
  assertEquals (XMLConstants.NULL_NS_URI, c.getNamespaceURI ("tns"));

  // Add any mapping
  c.addMapping ("tns", "http://1");
  assertNull (c.getDefaultNamespaceURI ());
  assertTrue (c.getPrefixes ("http://1").hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XML_NS_URI).hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XMLNS_ATTRIBUTE_NS_URI).hasNext ());

  assertEquals ("tns", c.getPrefix ("http://1"));
  assertEquals (XMLConstants.XML_NS_PREFIX, c.getPrefix (XMLConstants.XML_NS_URI));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE, c.getPrefix (XMLConstants.XMLNS_ATTRIBUTE_NS_URI));

  assertEquals (XMLConstants.NULL_NS_URI, c.getNamespaceURI (XMLConstants.DEFAULT_NS_PREFIX));
  assertEquals (XMLConstants.XML_NS_URI, c.getNamespaceURI (XMLConstants.XML_NS_PREFIX));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE_NS_URI, c.getNamespaceURI (XMLConstants.XMLNS_ATTRIBUTE));
  assertEquals ("http://1", c.getNamespaceURI ("tns"));

  // Add default mapping
  c.addMapping (XMLConstants.DEFAULT_NS_PREFIX, "http://default");
  assertEquals ("http://default", c.getDefaultNamespaceURI ());
  assertTrue (c.getPrefixes ("http://1").hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XML_NS_URI).hasNext ());
  assertTrue (c.getPrefixes (XMLConstants.XMLNS_ATTRIBUTE_NS_URI).hasNext ());

  assertEquals (XMLConstants.DEFAULT_NS_PREFIX, c.getPrefix ("http://default"));
  assertEquals ("tns", c.getPrefix ("http://1"));
  assertEquals (XMLConstants.XML_NS_PREFIX, c.getPrefix (XMLConstants.XML_NS_URI));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE, c.getPrefix (XMLConstants.XMLNS_ATTRIBUTE_NS_URI));

  assertEquals ("http://default", c.getNamespaceURI (XMLConstants.DEFAULT_NS_PREFIX));
  assertEquals (XMLConstants.XML_NS_URI, c.getNamespaceURI (XMLConstants.XML_NS_PREFIX));
  assertEquals (XMLConstants.XMLNS_ATTRIBUTE_NS_URI, c.getNamespaceURI (XMLConstants.XMLNS_ATTRIBUTE));
  assertEquals ("http://1", c.getNamespaceURI ("tns"));
  assertEquals ("http://default", c.getNamespaceURI (XMLConstants.DEFAULT_NS_PREFIX));

  CommonsTestHelper.testToStringImplementation (c);
  CommonsTestHelper.testDefaultSerialization (c);
}