com.sap.aii.utilxi.rtcheck.base

Class TestResult

java.lang.Object
  extended by com.sap.aii.utilxi.rtcheck.base.TestResult
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SingleTestResult, TestSuitResult

public abstract class TestResult
extends Object
implements Serializable

This class is an abstract superclass for outcomes of tests. Instances of its sub-classes are returned as part of various self-test features in PI.

See Also:
Serialized Form

Field Summary
static int NOT_OK
          Integer constant representing an unsuccessful result.
static String NOT_OK_STRING
          Constant label representing an un-successful result.
static int OK
          Integer constant representing a successful result.
static String OK_STRING
          Constant label representing a successful result.
static int OK_WITH_WARNING
          Integer constant representing a successful result with reservations.
static String OK_WITH_WARNING_STRING
          Constant label representing a successful result, but with reservations.
protected  int overallResult
          Overall outcome of the test
static int[] RESULT_VARIANTS
          Array of all result constants.
static int UNDEFINED
          Integer constant representing an 'undefined' result.
static String UNDEFINED_STRING
          Constant label representing an undefined result.
static String UNDERSCORED_NOT_OK_STRING
          Alternative constant label representing an unsuccessful result.
static String UNDERSCORED_OK_WITH_WARNING_STRING
          Alternative constant label representing a successful result with reservations.
 
Constructor Summary
TestResult()
          Creates initial (empty) test result.
TestResult(int overallResult, String feature, String featureDescr)
          Creates a test result for a given feature with a given overall result.
 
Method Summary
 void addTestResult(TestResult result)
          Adds a new test result to this instance.
static int asInt(String result)
          Returns an integer value representing the test result label result .
static String asString(int result)
          Returns a String label representing the test result result.
 String getCheckedFeature()
          Gets the tested feature name.
 Object getDetails()
          Returns the custom details object associated with his test result or null if no such object is associated.
 String getFeatureDescription()
          Gets the tested feature description.
 int getOverallResult()
          Obtain the overall result of this test
 Collection getSubResults()
          Returns a collection of all sub-results of this instance.
static int getWorst(int result1, int result2)
          Compares 2 test results and returns the "worst" of them.
 boolean hasDetails()
          Returns true if this instance has an associated details object and false otherwise
 void setCheckedFeature(String checkedFeature)
          Sets the tested feature name.
 void setFeatureDescription(String featureDescription)
          Sets the tested feature description.
 void setOverallResult(int overallResult)
          Sets the overall result of this test
protected  String shortDescription()
          Returns a textual description of overall result, checked feature and feature description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Integer constant representing an 'undefined' result.

See Also:
Constant Field Values

OK

public static final int OK
Integer constant representing a successful result.

See Also:
Constant Field Values

OK_WITH_WARNING

public static final int OK_WITH_WARNING
Integer constant representing a successful result with reservations.

See Also:
Constant Field Values

NOT_OK

public static final int NOT_OK
Integer constant representing an unsuccessful result.

See Also:
Constant Field Values

UNDEFINED_STRING

public static final String UNDEFINED_STRING
Constant label representing an undefined result.

See Also:
Constant Field Values

OK_STRING

public static final String OK_STRING
Constant label representing a successful result.

See Also:
Constant Field Values

OK_WITH_WARNING_STRING

public static final String OK_WITH_WARNING_STRING
Constant label representing a successful result, but with reservations.

See Also:
Constant Field Values

NOT_OK_STRING

public static final String NOT_OK_STRING
Constant label representing an un-successful result.

See Also:
Constant Field Values

UNDERSCORED_OK_WITH_WARNING_STRING

public static final String UNDERSCORED_OK_WITH_WARNING_STRING
Alternative constant label representing a successful result with reservations.

See Also:
Constant Field Values

UNDERSCORED_NOT_OK_STRING

public static final String UNDERSCORED_NOT_OK_STRING
Alternative constant label representing an unsuccessful result.

See Also:
Constant Field Values

RESULT_VARIANTS

public static final int[] RESULT_VARIANTS
Array of all result constants.


overallResult

protected int overallResult
Overall outcome of the test

Constructor Detail

TestResult

public TestResult()
Creates initial (empty) test result.


TestResult

public TestResult(int overallResult,
                  String feature,
                  String featureDescr)
Creates a test result for a given feature with a given overall result.

Parameters:
overallResult - test outcome
feature - checked feature
featureDescr - more detailed feature description
Method Detail

asInt

public static int asInt(String result)
Returns an integer value representing the test result label result . Returns constant UNDEFINED, if result can not be interpreted as test result.

Parameters:
result - a test result label
Returns:
integral constant corresponding to the given label

asString

public static String asString(int result)
Returns a String label representing the test result result. Returns null, if result can not be interpreted as test result.

Parameters:
result - a test result integer value
Returns:
constant label corresponding to the given integral value

getWorst

public static int getWorst(int result1,
                           int result2)
Compares 2 test results and returns the "worst" of them. If "<" denotes "worse than", then:

NOT_OK < OK_WITH_WARNING < OK < UNDEFINED


getOverallResult

public int getOverallResult()
Obtain the overall result of this test

Returns:
overall result

setOverallResult

public void setOverallResult(int overallResult)
Sets the overall result of this test

Parameters:
overallResult - integer value which should be one of the constants in RESULT_VARIANTS.

setCheckedFeature

public void setCheckedFeature(String checkedFeature)
Sets the tested feature name.

Parameters:
checkedFeature -

getCheckedFeature

public String getCheckedFeature()
Gets the tested feature name.

Returns:
feature name

setFeatureDescription

public void setFeatureDescription(String featureDescription)
Sets the tested feature description.

Parameters:
featureDescription -

getFeatureDescription

public String getFeatureDescription()
Gets the tested feature description.

Returns:

addTestResult

public void addTestResult(TestResult result)
Adds a new test result to this instance. Should be overwritten by subclasses. The implementation in this class is a no-op.


getSubResults

public Collection getSubResults()
Returns a collection of all sub-results of this instance. Returns an emptoy collection if there are no sub-results.


shortDescription

protected String shortDescription()
Returns a textual description of overall result, checked feature and feature description.

Returns:
description of test result

hasDetails

public boolean hasDetails()
Returns true if this instance has an associated details object and false otherwise


getDetails

public Object getDetails()
Returns the custom details object associated with his test result or null if no such object is associated.



Copyright 2011 SAP AG Complete Copyright Notice