|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
lp.wrap.LparseWrapperTest
public class LparseWrapperTest
Contains tests of the LparseWrapper
class.
LparseWrapper
Field Summary | |
---|---|
private LparseWrapper |
lw
The LparseWrapper instance used in the tests. |
Constructor Summary | |
---|---|
LparseWrapperTest(String testName)
A default test case constructor. |
Method Summary | |
---|---|
private void |
doTest(String input,
Set<String> expOutput,
LparseMessage expError,
List<LparseMessage> expWarnings)
Has the same effect as calling doTest(input, "-t", expOutput, expError, expWarnings) . |
private void |
doTest(String input,
String options,
Set<String> expOutput,
LparseMessage expError,
List<LparseMessage> expWarnings)
Performs a single call of lw.setInput(input); lw.setOptions(options); InputStream outputStream = lw.exec(); and tests if expected output, error and warnings are detected by lw . |
void |
testErrorFreeInput()
Tests LparseWrapper on an error free input. |
void |
testInputWithError()
Tests LparseWrapper on an input with a single error and no
warnings. |
void |
testMultipleWarnings()
Tests LparseWrapper on an input with a multiple warnings and
no error. |
void |
testOneWarning()
Tests LparseWrapper on an input with a single warning and no
error. |
void |
testSetLparsePath()
Tests the LparseWrapper.setLparsePath(String) method. |
void |
testSetOptions()
Tests the LparseWrapper.setOptions(String) and
LparseWrapper.exec() methods—sets a simple option string
and a simple input string and tests if the correct output is produced by
lparse. |
void |
testSimpleInput()
Tests the LparseWrapper.exec() method—sets a simple input
string and tests if the correct output is produced by lparse. |
void |
testWarningAsError()
Tests LparseWrapper on an input with a single error but without
an error message. |
void |
testWarningAsError2()
Tests LparseWrapper on an input with a single error with an error
message that begins with "Error:". |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, 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 |
---|
private final LparseWrapper lw
LparseWrapper
instance used in the tests.
Constructor Detail |
---|
public LparseWrapperTest(String testName)
testName
- the name of the test caseMethod Detail |
---|
public void testSetLparsePath() throws IOException
LparseWrapper.setLparsePath(String)
method.
IOException
public void testSetOptions() throws IOException
LparseWrapper.setOptions(String)
and
LparseWrapper.exec()
methods—sets a simple option string
and a simple input string and tests if the correct output is produced by
lparse.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
WrapperException
- if an IOException
occurs while creating
the process or if an InterruptedException
occurs while waiting
for the process instance to finish execution.
IOException
- if an I/O error occurs while setting the standard
input or while reading the output of the process (should never happen)public void testSimpleInput() throws IOException
LparseWrapper.exec()
method—sets a simple input
string and tests if the correct output is produced by lparse.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
WrapperException
- if an IOException
occurs while creating
the process or if an InterruptedException
occurs while waiting
for the process instance to finish execution.
IOException
- if an I/O error occurs while setting its standard
input or while reading the output of the process (should never happen)public void testErrorFreeInput() throws IOException
LparseWrapper
on an error free input.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)public void testInputWithError() throws IOException
LparseWrapper
on an input with a single error and no
warnings.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)public void testWarningAsError() throws IOException
LparseWrapper
on an input with a single error but without
an error message. This situation sometimes occurs when lparse considers
warnings as errors.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)public void testWarningAsError2() throws IOException
LparseWrapper
on an input with a single error with an error
message that begins with "Error:". This situation sometimes occurs when
lparse considers warnings as errors.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)public void testOneWarning() throws IOException
LparseWrapper
on an input with a single warning and no
error.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)public void testMultipleWarnings() throws IOException
LparseWrapper
on an input with a multiple warnings and
no error.
This test can only pass if the lparse binary can be executed by issuing a
simple "lparse"
command.
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)private void doTest(String input, Set<String> expOutput, LparseMessage expError, List<LparseMessage> expWarnings) throws IOException, WrapperException
doTest(input, "-t", expOutput, expError, expWarnings)
.
input
- the lparse input to testexpOutput
- the expected lparse outputexpError
- the expected lparse errorexpWarnings
- the expected lparse warnings
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)private void doTest(String input, String options, Set<String> expOutput, LparseMessage expError, List<LparseMessage> expWarnings) throws IOException
lw.setInput(input); lw.setOptions(options); InputStream outputStream = lw.exec();and tests if expected output, error and warnings are detected by
lw
.
input
- the lparse input to testoptions
- the lparse options to testexpOutput
- the expected lparse outputexpError
- the expected lparse errorexpWarnings
- the expected lparse warnings
IOException
- if an I/O error occurs while testing (should never
happen)
WrapperException
- if an error occurs while executing lparse
(should never happen)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |