dion 2002/06/24 00:17:43
Modified: src/test/org/apache/maven/build PluginDescriptorTest.java
Log:
Added tests for reports and extensions - all now load ok
Revision Changes Path
1.2 +61 -2
jakarta-turbine-maven/src/test/org/apache/maven/build/PluginDescriptorTest.java
Index: PluginDescriptorTest.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/build/PluginDescriptorTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PluginDescriptorTest.java 24 Jun 2002 03:46:16 -0000 1.1
+++ PluginDescriptorTest.java 24 Jun 2002 07:17:43 -0000 1.2
@@ -61,7 +61,9 @@
import junit.framework.TestCase;
import org.apache.maven.plugin.Dependency;
+import org.apache.maven.plugin.Extension;
import org.apache.maven.plugin.Plugin;
+import org.apache.maven.plugin.Report;
import org.apache.maven.plugin.Task;
@@ -171,7 +173,64 @@
for (int i = 0; i < names.length; i++)
{
task = (Task) tasks.get(i);
- assertEquals("name is wrong", names[i], task.getName());
+ assertEquals("name[" + i + "] is wrong", names[i], task.getName());
}
+ }
+
+ /**
+ * Test the reports are loaded correctly
+ *
+ * @throws Exception when an error occurs
+ */
+ public void testReports() throws Exception
+ {
+ testFileConstructor();
+ List reports = instance.getPlugin().getReports();
+ assertNotNull("reports not created", reports);
+ assertEquals("# of reports is wrong", 2, reports.size());
+ Report first = (Report) reports.get(0);
+ assertEquals("First document is bad", "ExtraReportX",
+ first.getDocument());
+ assertEquals("First name is bad", "Extra Report X", first.getName());
+ assertEquals("First output is bad", "html/xml (xdocs)/?",
+ first.getOutput());
+ Report second = (Report) reports.get(1);
+ assertEquals("Second document is bad", "clover-report-html",
+ second.getDocument());
+ assertEquals("Second name is bad", "Clover coverage", second.getName());
+ assertEquals("Second output is bad", "html", second.getOutput());
+ }
+
+ /**
+ * test the extensions are loaded correctly
+ *
+ * @throws Exception when an error occurs
+ */
+ public void testExtensions() throws Exception
+ {
+ testFileConstructor();
+ List extensions = instance.getPlugin().getExtensions();
+ assertNotNull("extensions not created", extensions);
+ assertEquals("# of extensions is wrong", 3, extensions.size());
+ Extension ext = null;
+ singleExtensionTest((Extension) extensions.get(0), "bollocks",
+ "excrete", "after", "7", "compile");
+ singleExtensionTest((Extension) extensions.get(1), "ballocks",
+ "execute", "before", "1", "jar");
+ singleExtensionTest((Extension) extensions.get(2), "bullocks",
+ "excrete", "before", "1", "dist");
+ }
+
+ /**
+ * test an extension object
+ */
+ public void singleExtensionTest(Extension e, String plugin, String task,
+ String position, String priority, String execute)
+ {
+ assertEquals("plugin value wrong", plugin, e.getPlugin());
+ assertEquals("task value wrong", task, e.getTask());
+ assertEquals("position value wrong", position, e.getPosition());
+ assertEquals("priority value wrong", priority, e.getPriority());
+ assertEquals("execute value wrong", execute, e.getExecute());
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>