Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lp.wrap
Class LparseWrapperTest

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              lp.wrap.LparseWrapperTest

All Implemented Interfaces:
  Test

    public class LparseWrapperTest

extends TestCase

Contains tests of the `LparseWrapper` class.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `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

### lw

    private final LparseWrapper lw

  The `LparseWrapper` instance used in the tests.

Constructor Detail

### LparseWrapperTest

    public LparseWrapperTest(String testName)

  A default test case constructor.

  Parameters:
    `testName` - the name of the test case

Method Detail

### testSetLparsePath

    public void testSetLparsePath()
                           throws IOException

  Tests the `LparseWrapper.setLparsePath(String)` method.

  Throws:
    `IOException`

### testSetOptions

    public void testSetOptions()
                        throws IOException

  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. This test can only pass if the lparse binary can be executed by issuing a simple `"lparse"` command.

  Throws:
    `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)

### testSimpleInput

    public void testSimpleInput()
                         throws IOException

  Tests the `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.

  Throws:
    `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)

### testErrorFreeInput

    public void testErrorFreeInput()
                            throws IOException

  Tests `LparseWrapper` on an error free input. This test can only pass if the lparse binary can be executed by issuing a simple `"lparse"` command.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### testInputWithError

    public void testInputWithError()
                            throws IOException

  Tests `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.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### testWarningAsError

    public void testWarningAsError()
                            throws IOException

  Tests `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.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### testWarningAsError2

    public void testWarningAsError2()
                             throws IOException

  Tests `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.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### testOneWarning

    public void testOneWarning()
                        throws IOException

  Tests `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.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### testMultipleWarnings

    public void testMultipleWarnings()
                              throws IOException

  Tests `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.

  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### doTest

    private void doTest(String input,
                        Set<String> expOutput,
                        LparseMessage expError,
                        List<LparseMessage> expWarnings)
                 throws IOException,
                        WrapperException

  Has the same effect as calling `doTest(input, "-t", expOutput, expError, expWarnings)`.

  Parameters:
    `input` - the lparse input to test
    `expOutput` - the expected lparse output
    `expError` - the expected lparse error
    `expWarnings` - the expected lparse warnings
  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

### doTest

    private void doTest(String input,
                        String options,
                        Set<String> expOutput,
                        LparseMessage expError,
                        List<LparseMessage> expWarnings)
                 throws IOException

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

  Parameters:
    `input` - the lparse input to test
    `options` - the lparse options to test
    `expOutput` - the expected lparse output
    `expError` - the expected lparse error
    `expWarnings` - the expected lparse warnings
  Throws:
    `IOException` - if an I/O error occurs while testing (should never happen)
    `WrapperException` - if an error occurs while executing lparse (should never happen)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD