JML

org.multijava.util.testing
Class FileCompareTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.multijava.util.testing.TestCase
              extended byorg.multijava.util.testing.FileCompareTestCase
All Implemented Interfaces:
junit.framework.Test

public class FileCompareTestCase
extends TestCase

This class is a jutils.framework.Test that compares two files. The user needs to make a derived class that overrides the (null) implementation of action, in order to do the relevant checking of the result of the compare.


Field Summary
(package private)  String command
          Holds the command String supplied in the constructor.
(package private)  String file1
          Holds the file name supplied in the constructor.
(package private)  String file2
          Holds the second file name supplied in the constructor.
 
Fields inherited from class org.multijava.util.testing.TestCase
NEWLINE
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
FileCompareTestCase(String name, String file1, String file2, String command)
          Constructs the appropriate Test.
 
Method Summary
 void action(int result, String outputText, String errorText)
          The user should override this to carry out an action (e.g.
 void runTest()
          The runTest method required by a Test - calling this executes the test.
 
Methods inherited from class org.multijava.util.testing.TestCase
assertDiff, assertEquals
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

command

String command
Holds the command String supplied in the constructor.


file1

String file1
Holds the file name supplied in the constructor.


file2

String file2
Holds the second file name supplied in the constructor.

Constructor Detail

FileCompareTestCase

public FileCompareTestCase(String name,
                           String file1,
                           String file2,
                           String command)
Constructs the appropriate Test.

Parameters:
name - The name of the test
file1 - The first of the files to be compared
file2 - The second of the files to be compared
command - The external command to be run to compare them, e.g. "diff"
Method Detail

runTest

public void runTest()
             throws IOException
The runTest method required by a Test - calling this executes the test. The actual effect is carried out in the 'action' method, which the user is expected to override.

Overrides:
runTest in class junit.framework.TestCase
Throws:
IOException

action

public void action(int result,
                   String outputText,
                   String errorText)
The user should override this to carry out an action (e.g. 'assertTrue(result==0)'). The method is called by the runTest method after the files have been compared.

Parameters:
result - The exit value produced by the external command supplied to the constructor. For example, a 'diff' command yields 0 for a match, 1 for a non-match, and 2 for an execution error.
outputText - The text produced by the output stream of the external process
errorText - The text produced by the error stream of the external process

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.