edu.rice.cs.drjava
Class CommandLineTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.drjava.CommandLineTest
All Implemented Interfaces:
Test

public final class CommandLineTest
extends DrJavaTestCase

Tests opening/creating files specified as command line arguments.

Version:
$Id: CommandLineTest.java 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
CommandLineTest(String name)
          Constructor.
 
Method Summary
 void setUp()
          Set up for every test.
 void tearDown()
          Clean up for every test case.
 void testDotPaths()
          Tests paths with "." and ".." in them.
 void testDups()
          Test duplicate files.
 void testMixed()
          Supplying both valid and invalid filenames on the command line.
 void testNE()
          A nonexistent file.
 void testNone()
          Tests DrJava with no command line arguments.
 void testOpenMany()
          Many files on the command line.
 void testOpenOne()
          Open one file on the command line.
 void testRelativePath()
          A regression test for bug #542747, which related to opening a file via the command line using a relative path.
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandLineTest

public CommandLineTest(String name)
Constructor. Sets up test files for us to use: (i) three files that exist and can be opened; (ii) three files that don't exist

Parameters:
name - the name of the test case
Method Detail

setUp

public void setUp()
           throws Exception
Description copied from class: DrJavaTestCase
Set up for every test.

Overrides:
setUp in class DrJavaTestCase
Throws:
Exception - This convention is mandated by JUnit.TestCase, the superclass of this class.

tearDown

public void tearDown()
              throws Exception
Description copied from class: DrJavaTestCase
Clean up for every test case. Only used in unit tests. Added because Windows would intermittently throw a java.util.concurrent.RejectedExecutionException during cleanup.

Overrides:
tearDown in class DrJavaTestCase
Throws:
Exception

testNone

public void testNone()
Tests DrJava with no command line arguments. Should open a new, untitled document.


testOpenOne

public void testOpenOne()
                 throws BadLocationException
Open one file on the command line. Should (obviously) open that file.

Throws:
BadLocationException

testNE

public void testNE()
A nonexistent file. Should open a new, untitled document.


testOpenMany

public void testOpenMany()
                  throws BadLocationException
Many files on the command line. Should open all of them, displaying the last one.

Throws:
BadLocationException

testMixed

public void testMixed()
               throws BadLocationException
Supplying both valid and invalid filenames on the command line. Should open only the valid ones.

Throws:
BadLocationException

testDups

public void testDups()
              throws BadLocationException
Test duplicate files.

Throws:
BadLocationException

testRelativePath

public void testRelativePath()
                      throws IOException,
                             InvalidPackageException
A regression test for bug #542747, which related to opening a file via the command line using a relative path. The problem was that getSourceRoot() would fail on the document, because the filename was not absolute. (The fix will be to absolutize file paths when opening files.)

Throws:
IOException
InvalidPackageException

testDotPaths

public void testDotPaths()
Tests paths with "." and ".." in them. Windows will blow up if you use one in a JFileChooser without converting it to a canonical filename.