//-------------------------------------------------------------------------
        public virtual void test_equalsHashCodeToString()
        {
            ByteSource source = ByteSource.wrap(SAMPLE.GetBytes(Encoding.UTF8));
            XmlFile    test   = XmlFile.of(source);
            XmlFile    test2  = XmlFile.of(source);

            assertFalse(test.Equals(null));
            assertFalse(test.Equals(ANOTHER_TYPE));
            assertEquals(test, test);
            assertEquals(test, test2);
            assertEquals(test.GetHashCode(), test2.GetHashCode());
            assertEquals(test.ToString(), test2.ToString());
        }
        //-------------------------------------------------------------------------
        public virtual void test_of_ByteSource()
        {
            ByteSource source = ByteSource.wrap(SAMPLE.GetBytes(Encoding.UTF8));
            XmlFile    test   = XmlFile.of(source);
            XmlElement root   = test.Root;

            assertEquals(root.Name, "base");
            assertEquals(root.Attributes, ATTR_MAP_EMPTY);
            assertEquals(root.Content, "");
            assertEquals(root.Children.size(), 1);
            XmlElement child = root.getChild(0);

            assertEquals(child, XmlElement.ofChildren("test", ATTR_MAP, CHILD_LIST_MULTI));
            assertEquals(test.References, ImmutableMap.of());
        }
        public virtual void test_of_ByteSource_namespace()
        {
            ByteSource source = ByteSource.wrap(SAMPLE_NAMESPACE.GetBytes(Encoding.UTF8));
            XmlFile    test   = XmlFile.of(source);
            XmlElement root   = test.Root;

            assertEquals(root.Name, "base");
            assertEquals(root.Attributes, ImmutableMap.of());
            assertEquals(root.Content, "");
            assertEquals(root.Children.size(), 2);
            XmlElement child1 = root.getChild(0);

            assertEquals(child1.Name, "p");
            assertEquals(child1.Content, "Some text");
            assertEquals(child1.Attributes, ImmutableMap.of());
            XmlElement child2 = root.getChild(1);

            assertEquals(child2.Name, "leaf1");
            assertEquals(child2.Content, "leaf");
            assertEquals(child2.Attributes, ImmutableMap.of("foo", "bla", "og", "strata"));
            assertEquals(test.References, ImmutableMap.of());
        }
        public virtual void test_of_ByteSource_parsedReferences_ioException()
        {
            ByteSource source = Files.asByteSource(new File("/oh-dear-no-such-file"));

            assertThrows(() => XmlFile.of(source, "key"), typeof(UncheckedIOException));
        }
        public virtual void test_of_ByteSource_badEnd()
        {
            ByteSource source = ByteSource.wrap(SAMPLE_BAD_END.GetBytes(Encoding.UTF8));

            assertThrowsIllegalArg(() => XmlFile.of(source));
        }
        public virtual void test_of_ByteSource_mismatchedTags()
        {
            ByteSource source = ByteSource.wrap(SAMPLE_MISMATCHED_TAGS.GetBytes(Encoding.UTF8));

            assertThrowsIllegalArg(() => XmlFile.of(source));
        }