dion 2002/06/10 08:18:24
Modified: src/java/org/apache/maven Build.java
src/test/org/apache/maven BuildTest.java
Log:
Tests for the -p or --project option
Change getOptions from static to non.
Revision Changes Path
1.2 +2 -2 jakarta-turbine-maven/src/java/org/apache/maven/Build.java
Index: Build.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/Build.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Build.java 10 Jun 2002 10:24:40 -0000 1.1
+++ Build.java 10 Jun 2002 15:18:24 -0000 1.2
@@ -88,7 +88,7 @@
* </ul>
*
* @author dion
- * @version $Id: Build.java,v 1.1 2002/06/10 10:24:40 dion Exp $
+ * @version $Id: Build.java,v 1.2 2002/06/10 15:18:24 dion Exp $
*/
public class Build
{
@@ -171,7 +171,7 @@
/**
* Provide a list of command line options supported
*/
- public static Options getOptions()
+ public Options getOptions()
{
Options options = new Options();
options.addOption(PROJECT_OPTION, PROJECT_LONG_OPTION, true,
1.2 +31 -2 jakarta-turbine-maven/src/test/org/apache/maven/BuildTest.java
Index: BuildTest.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/BuildTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BuildTest.java 10 Jun 2002 11:51:13 -0000 1.1
+++ BuildTest.java 10 Jun 2002 15:18:24 -0000 1.2
@@ -62,12 +62,12 @@
* Unit tests for {@link Build}
*
* @author dion
- * @version $Id: BuildTest.java,v 1.1 2002/06/10 11:51:13 dion Exp $
+ * @version $Id: BuildTest.java,v 1.2 2002/06/10 15:18:24 dion Exp $
*/
public class BuildTest extends TestCase
{
/** instance being tested */
- Build instance = new Build();
+ Build instance;;
/** Creates a new instance of the test case
* @param testName the name of the test
@@ -77,9 +77,38 @@
super(testName);
}
+ /**
+ * Initialize per test data
+ * @throws Exception when there is an unexpected problem
+ */
+ public void setUp() throws Exception
+ {
+ instance = new Build();
+ }
+
+
+ /** test that the instance got created */
public void testConstructor()
{
assertNotNull("instance not available", instance);
+ }
+
+ /** test that configuration works for pom short param name */
+ public void testConfigureProjectDescriptorShort() throws Exception
+ {
+ String dummyProjectFile = "p.xml";
+ instance.configure(new String[] {"-p", dummyProjectFile});
+ assertEquals("-p option not parsed",
+ instance.getProjectDescriptorFileName(), dummyProjectFile);
+ }
+
+ /** test that configuration works for pom with long args */
+ public void testConfigureProjectDescriptorLong() throws Exception
+ {
+ String dummyProjectFile = "p.xml";
+ instance.configure(new String[] {"--project", dummyProjectFile});
+ assertEquals("--project option not parsed",
+ instance.getProjectDescriptorFileName(), dummyProjectFile);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>