Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

148
 
161
 
161
 
ArgsTest.java
_> 1717 
  1818 import junit.framework.TestCase;
  1919 
<>  20+import org.laughingpanda.halo.commands.Command;
2021 import org.laughingpanda.halo.commands.eclipse.GenerateEclipseDotClasspathFileCommand;
  2122 import org.laughingpanda.halo.commands.project.CleanCommand;
  2223 import org.laughingpanda.halo.commands.project.DefaultBuildCommand;
     
 !
2728  */
  2829 public class ArgsTest extends TestCase {
  2930     public void testShouldGiveSelfBuildCommandForEmptyArgumentList() {
<> 30 -        assertTrue(new Args(new ProjectProperties()).getCommand() instanceof DefaultBuildCommand);
   31+        assertParsedCommandType(DefaultBuildCommand.class);
3132     }
<> 32 -   
   33+
3334     public void testShouldGiveEclipseCommandWhenArgumentIsEclipse() {
<> 34 -        assertTrue(new Args(new ProjectProperties(), "eclipse").getCommand() instanceof GenerateEclipseDotClasspathFileCommand);
   35+        assertParsedCommandType(GenerateEclipseDotClasspathFileCommand.class, "eclipse");
3536     }
<> 36 -   
   37+
3738     public void testShouldGiveCleanCommandWhenArgumentIsClean() {
<> 38 -        assertTrue(new Args(new ProjectProperties(), "clean").getCommand() instanceof CleanCommand);
   39+        assertParsedCommandType(CleanCommand.class, "clean");
3940     }
<> 40 -   
   41+
   42+    private void assertParsedCommandType(Class<?> expectedCommandType, String... args) {
   43+        Command command = new Args(new ProjectProperties(), args).getCommand();
   44+        assertTrue(command.getClass().equals(expectedCommandType));
   45+    }
   46+
<_ 4147     public void testShouldThrowExceptionIfArgumentIsNotRecognized() {
  4248         try {
  4349             new Args(new ProjectProperties(), "unknown").getCommand();