laser.alphabet.test
Class EventAlphabetTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by laser.alphabet.test.EventAlphabetTest
All Implemented Interfaces:
junit.framework.Test

public class EventAlphabetTest
extends junit.framework.TestCase


Nested Class Summary
 class EventAlphabetTest.MockAlphabetChangeListener<L extends LabelInterface>
          Implements an AlphabetChangeListener
 class EventAlphabetTest.MockIntegerAnnotation
           
 class EventAlphabetTest.MockStringAnnotation
           
 
Field Summary
static StringAlphabetFactory factory
          A StringAlphabetFactory to use with the tests.
 
Constructor Summary
EventAlphabetTest(java.lang.String name)
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testAdd()
          Tests the Alphabet.add() method.
 void testAddAll()
          Tests the StringAlphabet.addAll() method.
 void testAddAnnotation()
          Tests the Alphabet.addAnnotation() method.
 void testAddAnnotations()
          Tests the Alphabet.addAnnotations() method.
 void testAlphabetChangeEvent()
           
 void testClear()
          Tests the StringAlphabet.clear() method.
 void testRemove()
          Tests the StringAlphabet.remove() method.
 void testRemoveAll()
          Tests the StringAlphabet.removeAll() method.
 void testRemoveAnnotation()
          Tests the Alphabet.removeAnnotation(Annotation) method.
 void testRemoveAnnotations()
          Tests the Alphabet.removeAnnotations() method.
 void testRemoveAnnotationsClassOfQextendsAnnotation()
          Tests the Alphabet.removeAnnotations(Class) method.
 void testRemoveAnnotationsCollectionOfQextendsAnnotation()
          Tests the Alphabet.removeAnnotations(Collection) method.
 void testRetainAll()
          Tests the StringAlphabet.retainAll() method.
 void testSetName()
          Tests the Alphabet.setName() method.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

public static StringAlphabetFactory factory
A StringAlphabetFactory to use with the tests.

Constructor Detail

EventAlphabetTest

public EventAlphabetTest(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testAlphabetChangeEvent

public final void testAlphabetChangeEvent()

testSetName

public final void testSetName()
Tests the Alphabet.setName() method. Also tests that events were fired when expected.

The equivalence classes for the input are: 1) null input 2) a valid String input.


testAdd

public final void testAdd()
Tests the Alphabet.add() method. This test relies on the fact that the contains method works properly. Also tests that events were fired when expected.

The equivalence classes for the input are: 1) null input 2) a StringLabel not contained in the alphabet already 3) a StringLabel already contained in the alphabet 4) non-StringLabel input.


testAddAll

public final void testAddAll()
Tests the StringAlphabet.addAll() method. This test relies on the fact that the containsAll and add methods work.

The equivalence classes for the input are: 1) null input. 2) Collection containing null elements. 3) Collection containing two StringLabels not contained in the Alphabet. 4) Collection containing three StringLabels, two of which are contained in the Alphabet, and one of which is not contained in the Alphabet. 5) Collection containing only StringLabels that are contained in the Alphabet already. 6) Collection containing non-StringLabel input.


testClear

public final void testClear()
Tests the StringAlphabet.clear() method. This test relies on the fact that the add and isEmpty methods work properly.

The equivalence classes are: 1) An Alphabet containing no labels. 2) An Alphabet containing three labels.


testRemove

public final void testRemove()
Tests the StringAlphabet.remove() method. This test relies on the fact that the contains and add methods work. The equivalence classes for the input are 1) null input, 2) non-StringLabel input, 3) a StringLabel not contained in the Alphabet 4) a StringLabel contained in the Alphabet.


testRemoveAll

public final void testRemoveAll()
Tests the StringAlphabet.removeAll() method. This test relies on the fact that the add, contains and remove methods work properly. The equivalence classes for input are 1) null input 2) Collection containing a null element 3) Collection containing non-StringLabel input 4) Collection containing no labels contained in this Alphabet 5) Collection containing only labels contained in this Alphabet 6) Collection containing some labels contained in this Alphabet, and some labels not contained in this Alphabet.


testRetainAll

public final void testRetainAll()
Tests the StringAlphabet.retainAll() method. This test relies on the fact that the add, contains and remove methods work properly. The equivalence classes for input are 1) null input 2) Collection containing a null element 3) Collection containing non-StringLabel input 4) Collection containing no labels contained in this Alphabet, Alphabet has one label. 5) Collection containing only labels contained in this Alphabet 6) Collection containing some labels contained in this Alphabet, and some labels not contained in this Alphabet.


testAddAnnotation

public final void testAddAnnotation()
Tests the Alphabet.addAnnotation() method. Also tests that events were fired when expected.

The equivalence classes for the input are: 1) null input 2) a valid Annotation


testAddAnnotations

public final void testAddAnnotations()
Tests the Alphabet.addAnnotations() method. Also tests that events are fired when expected.

The equivalence classes for the input are: 1) null input 2) Collection containing a null 3) Collection containing two valid Annotation


testRemoveAnnotation

public final void testRemoveAnnotation()
Tests the Alphabet.removeAnnotation(Annotation) method. Also tests that events are fired when expected.

The equivalence classes for the input are: 1) null input 2) a valid Annotation 3) an Annotation not contained in the AnnotationTable for the Alphabet.


testRemoveAnnotationsCollectionOfQextendsAnnotation

public final void testRemoveAnnotationsCollectionOfQextendsAnnotation()
Tests the Alphabet.removeAnnotations(Collection) method. Also tests that events are fired when expected.

The equivalence classes for the input are: 1) null input 2) Collection containing a null 3) Collection containing two valid Annotations 3) Collection containing two valid Annotations and one Annotation not contained in the AnnotationTable for the Alphabet. 4) Collection containing no Annotations contained in the AnnotationTable for the Alphabet.


testRemoveAnnotationsClassOfQextendsAnnotation

public final void testRemoveAnnotationsClassOfQextendsAnnotation()
Tests the Alphabet.removeAnnotations(Class) method. Also tests that events are fired when expected.

The equivalence classes for the input are: 1) null input 2) Class comprising some of the Annotations in the AnnotationTable for the Alphabet. 3) Class not contained in the AnnotationTable for the Alphabet. 4) Class comprising all of the Annotations in the AnnotationTable for the Alphabet.


testRemoveAnnotations

public final void testRemoveAnnotations()
Tests the Alphabet.removeAnnotations() method. Also tests that events are fired when expected.