lp.wrap
Class SmodelsWrapperTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by lp.wrap.SmodelsWrapperTest
All Implemented Interfaces:
Test

public class SmodelsWrapperTest
extends TestCase

Contains tests of the SmodelsWrapper class.

Version:
1.0.0
Author:
Martin Slota
See Also:
SmodelsWrapper

Field Summary
private  SmodelsWrapper sw
          The SmodelsWrapper instance used in the tests.
 
Constructor Summary
SmodelsWrapperTest(String testName)
          A default test case constructor.
 
Method Summary
 void testSetModelLimit()
          Tests the SmodelsWrapper.setModelLimit(int) and SmodelsWrapper.exec() methods—sets a maximum model count limit and a simple input string and tests if the correct output is produced by smodels.
 void testSetSmodelsPath()
          Tests the SmodelsWrapper.setSmodelsPath(String) method.
 void testSimpleInput()
          Tests the SmodelsWrapper.exec() method—sets a simple input string and tests if the correct output is produced by smodels.
 
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

sw

private final SmodelsWrapper sw
The SmodelsWrapper instance used in the tests.

Constructor Detail

SmodelsWrapperTest

public SmodelsWrapperTest(String testName)
A default test case constructor.

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

testSetSmodelsPath

public void testSetSmodelsPath()
                        throws IOException
Tests the SmodelsWrapper.setSmodelsPath(String) method.

Throws:
IOException

testSimpleInput

public void testSimpleInput()
                     throws IOException
Tests the SmodelsWrapper.exec() method—sets a simple input string and tests if the correct output is produced by smodels. This test can only pass if the smodels binary can be executed by issuing a simple "smodels" 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)

testSetModelLimit

public void testSetModelLimit()
                       throws IOException
Tests the SmodelsWrapper.setModelLimit(int) and SmodelsWrapper.exec() methods—sets a maximum model count limit and a simple input string and tests if the correct output is produced by smodels. This test can only pass if the smodels binary can be executed by issuing a simple "smodels" 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)