Keel 2.1RC2

org.keel.util.test
Class KeelModelTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.keel.util.test.AbstractKeelTest
              extended byorg.keel.util.test.KeelModelTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
DisplayConfigTest, ModelValidationsTest

public abstract class KeelModelTestCase
extends AbstractKeelTest

Title: KeelModelTestCase.java

Description: Abstract KeelModel specific TestCase. The actual Model test classes will extend this TestCase, which handles the set-up work needed for the keel container.

See keel-container/src/test/org/keel/models/util/DisplayConfig.java for an example of this class in use.

Company: Donated to keel by Audit Integrity

Version:
1.1
Author:
rthoma

Field Summary
private  ModelRequest myModelRequest
           
 
Fields inherited from class org.keel.util.test.AbstractKeelTest
hint, myContainer
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
KeelModelTestCase(java.lang.String name)
          Initialize the test case with the given name
 
Method Summary
protected  ModelRequest getModelRequest()
          Get the ModelRequest object we initialized, ready to be used by the actual test class.
protected  void setUp()
          Performs the set-up needed for models to run:
1) Instantiating the keel container
2) Sets up the modelRequest object
3) Supplying it with a Context
4) Putting a pre-initialized test UserEnvironment in that context
protected  void showModelErrors(ModelResponse res)
          Convenience method to display in a human-readable format any errors returned by the model.
protected  void showModelResponse(ModelResponse res)
          Convenience method to dump the entire model response to stderr in a human-readable format.
protected  void tearDown()
          Release the model request initialized in setup()
 
Methods inherited from class org.keel.util.test.AbstractKeelTest
getContainer, getService, main, suite
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myModelRequest

private ModelRequest myModelRequest
Constructor Detail

KeelModelTestCase

public KeelModelTestCase(java.lang.String name)
Initialize the test case with the given name

Parameters:
name - Name of the test being instantiated
Method Detail

setUp

protected void setUp()
Performs the set-up needed for models to run:
1) Instantiating the keel container
2) Sets up the modelRequest object
3) Supplying it with a Context
4) Putting a pre-initialized test UserEnvironment in that context

Overrides:
setUp in class AbstractKeelTest

tearDown

protected void tearDown()
                 throws java.lang.Exception
Release the model request initialized in setup()

Overrides:
tearDown in class AbstractKeelTest
Throws:
java.lang.Exception - if the release causes an error

getModelRequest

protected ModelRequest getModelRequest()
Get the ModelRequest object we initialized, ready to be used by the actual test class.

Returns:

showModelErrors

protected void showModelErrors(ModelResponse res)
Convenience method to display in a human-readable format any errors returned by the model.

Parameters:
res - The ModelResponse returned by executing the model

showModelResponse

protected void showModelResponse(ModelResponse res)
Convenience method to dump the entire model response to stderr in a human-readable format. Very handy for debugging.

Parameters:
res - The response from the model just executed.

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.