cdx.scorebot.net
Class TestSuite

java.lang.Object
  extended by cdx.scorebot.net.TestSuite
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<TestSuite>

public class TestSuite
extends java.lang.Object
implements java.lang.Comparable<TestSuite>, java.io.Serializable

Contains the TestItems for a given Service, when to schedule those tests, and how to score their results. The Service object will be used to instantiate Tests with their constructors. This ensures the Tests are compatible with the Service (otherwise, such a constructor wont exist).

Author:
David Underhill
See Also:
Serialized Form

Constructor Summary
TestSuite(Service service)
          instantiates a TestSuite for the specified Service
 
Method Summary
 void addTestItem(TestItem ti)
          Adds a TestItem to be tested.
 int compareTo(TestSuite anotherTestSuite)
          Compares the names of two test suites lexicographically, ignoring case considerations
 boolean equals(java.lang.Object o)
           
 java.lang.String getDescription()
          gets a description of the purpose of this TestSuite
 java.lang.String getName()
          gets the name of this suite
 java.lang.String getNameNoSpaces()
          gets the name of this suite with underscores in place of spaces
 ScoringRuleset getScoringRuleset()
          gets the rules for scoring the service
 Service getService()
          gets the service being tested by this suite
 java.lang.String getServiceDescription()
          gets a description of the service
 java.lang.String getServiceName()
          gets the name of the service
 TestItem getTestItem(int index)
          Gets the specified TestItem
 java.util.Vector<TestItem> getTestItems()
          gets the items being tested
 boolean hasRule(java.lang.String ruleName)
          Determines whether or not this TestSuite contains a rule with the specified name
 void removeTestItem(int index)
          Removes the TestItem from this TestSuite
 void setDescription(java.lang.String description)
          sets a description of the purpose of this TestSuite
 void setName(java.lang.String name)
          sets name of this TestSuite
 java.lang.String toString()
          returns the name of this test suite
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestSuite

public TestSuite(Service service)
instantiates a TestSuite for the specified Service

Parameters:
service - the service being tested by this suite; will be used to instantiate Tests
Method Detail

compareTo

public int compareTo(TestSuite anotherTestSuite)
Compares the names of two test suites lexicographically, ignoring case considerations

Specified by:
compareTo in interface java.lang.Comparable<TestSuite>
Parameters:
anotherTestSuite - the TestSuite to be compared
Returns:
a negative integer, zero, or a positive integer as this TestSuite's name comes before or after, or is equal to, the specified TestSuite.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hasRule

public boolean hasRule(java.lang.String ruleName)
Determines whether or not this TestSuite contains a rule with the specified name

Parameters:
ruleName - the name of the rule to check for
Returns:
true if ruleName was the name of a rule in this suite

toString

public java.lang.String toString()
returns the name of this test suite

Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
gets the name of this suite


getNameNoSpaces

public java.lang.String getNameNoSpaces()
gets the name of this suite with underscores in place of spaces


setName

public void setName(java.lang.String name)
             throws IllegalArgValException
sets name of this TestSuite

Throws:
IllegalArgValException

getDescription

public java.lang.String getDescription()
gets a description of the purpose of this TestSuite


setDescription

public void setDescription(java.lang.String description)
sets a description of the purpose of this TestSuite


getService

public Service getService()
gets the service being tested by this suite


addTestItem

public void addTestItem(TestItem ti)
Adds a TestItem to be tested.

Parameters:
ti - the TestItem to add to this TestSuite

removeTestItem

public void removeTestItem(int index)
                    throws java.lang.ArrayIndexOutOfBoundsException
Removes the TestItem from this TestSuite

Parameters:
index - remove the TestItem at the specified index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.

getTestItem

public TestItem getTestItem(int index)
                     throws java.lang.ArrayIndexOutOfBoundsException
Gets the specified TestItem

Returns:
the TestItem at the specified index in the TestItem vector
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.

getTestItems

public java.util.Vector<TestItem> getTestItems()
gets the items being tested


getScoringRuleset

public ScoringRuleset getScoringRuleset()
gets the rules for scoring the service


getServiceName

public java.lang.String getServiceName()
gets the name of the service


getServiceDescription

public java.lang.String getServiceDescription()
gets a description of the service