/**
 *  Copyright 2012 Sven Ewald
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.xmlbeam.tutorial.e04_maven;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.xml.sax.SAXException;
import org.xmlbeam.XBProjector;
import org.xmlbeam.XBProjector.Flags;
import org.xmlbeam.tutorial.Tutorial;
import org.xmlbeam.tutorial.TutorialTestCase;
import org.xmlbeam.tutorial.e04_maven.MavenPOM.Artifact;

@SuppressWarnings("javadoc")
//START SNIPPET: Tutorial4
@Category(Tutorial.class)
public class TestMavenPOM extends TutorialTestCase {

/* START SNIPPET: TutorialDescription
~~
 A Maven project has a group id, artifact id and a version.
 So does a Maven dependency.
 Now we reuse the same sub projection for unrelated, but similar parts of the document.
 This is possible because the structure of our projection does not need to follow the structure of the document.

 Second we define a simple setter in the projection interface to show how element values can be modified.
END SNIPPET: TutorialDescription */

    @Test
    public void testProjectNameWriting() throws SAXException, IOException, ParserConfigurationException {
//START SNIPPET: TestMavenPOM
MavenPOM pom = new XBProjector(Flags.TO_STRING_RENDERS_XML).io().fromURLAnnotation(MavenPOM.class);
pom.setName("New name");
for (Artifact artifact:pom.getDependencies()) {
    if (artifact.equals(pom.getProjectId())) {
        System.out.println("Hmm... your project depends on itself!");
    }
}
//END SNIPPET: TestMavenPOM
    }
}

@@ -635,24 +635,68 @@
 e04_maven;%0A%0A
+import static org.junit.Assert.assertTrue;%0A%0A
 import java.
@@ -1969,16 +1969,60 @@
 name%22);%0A
+assertTrue(pom.getDependencies().length%3E0);%0A
 for (Art
@@ -2178,16 +2178,52 @@
 elf!%22);%0A
+        throw new AssertionError();%0A
     %7D%0A%7D%0A

Add assertions