edu.rice.cs.drjava
Class CommandLineTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.CommandLineTest
All Implemented Interfaces:
Test

public class CommandLineTest
extends TestCase

Tests opening/creating files specified as command line arguments.

Version:
$Id: CommandLineTest.java,v 1.5 2002/09/04 21:02:13 csreis Exp $

Field Summary
private  MainFrame _mf
          The MainFrame we're working with.
private  File f1
          Files that exist, and the filenames that represent them.
private  String f1_contents
           
private  String f1_name
           
private  File f2
           
private  String f2_contents
           
private  String f2_name
           
private  File f3
           
private  String f3_contents
           
private  String f3_name
           
private  File nof1
          Files that do not exist (constructor deletes them), and their filenames.
private  String nof1_name
           
private  File nof2
           
private  String nof2_name
           
private  File nof3
           
private  String nof3_name
           
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
CommandLineTest(String name)
          Constructor.
 
Method Summary
 void setUp()
           
 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 junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

_mf

private MainFrame _mf
The MainFrame we're working with.

f1

private final File f1
Files that exist, and the filenames that represent them.

f1_name

private final String f1_name

f1_contents

private final String f1_contents

f2

private final File f2

f2_name

private final String f2_name

f2_contents

private final String f2_contents

f3

private final File f3

f3_name

private final String f3_name

f3_contents

private final String f3_contents

nof1

private final File nof1
Files that do not exist (constructor deletes them), and their filenames.

nof2

private final File nof2

nof3

private final File nof3

nof1_name

private final String nof1_name

nof2_name

private final String nof2_name

nof3_name

private final String nof3_name
Constructor Detail

CommandLineTest

public CommandLineTest(String name)
Constructor. Sets up test files for us to use: - three files that exist and can be opened - three files that don't exist
Parameters:
String - name
Method Detail

setUp

public void setUp()
Overrides:
setUp in class TestCase

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.

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.

testMixed

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

testDups

public void testDups()
              throws BadLocationException
Test duplicate files.

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.)