laser.alphabet.labelpattern.test
Class IndexedLabelPatternFactoryTest

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

public class IndexedLabelPatternFactoryTest
extends AbstractIndexedLabelPatternTest

The IndexedLabelPatternFactoryTest class provides testing for the IndexedLabelPatternFactory class.

Author:
Nathan A. Jokel (laser-software@cs.umass.edu)
See Also:
IndexedLabelPatternFactory

Field Summary
 
Fields inherited from class laser.alphabet.labelpattern.test.AbstractIndexedLabelPatternTest
factory, probe
 
Constructor Summary
IndexedLabelPatternFactoryTest()
           
 
Method Summary
 void testIndexedAlphabetFactoryCreateLabelInterface()
          Tests the IndexedLabelPatternFactory.createLabelInterface() method.
 void testIndexedLabelPatternFactoryCreateAllLabelPatternInterface()
          Tests the IndexedLabelPatternFactory.createAllLabelPatternInterface() method.
 void testIndexedLabelPatternFactoryCreateAlphabetInterface()
          Tests the IndexedLabelPatternFactory.createAlphabetInterface() method.
 void testIndexedLabelPatternFactoryCreateClassSetLabelPatternInterface()
          Tests the IndexedLabelPatternFactory.createClassSetLabelPatternInterface() method.
 void testIndexedLabelPatternFactoryCreateLabelPatternInterface()
          Tests the IndexedLabelPatternFactory.createLabelPatternInterface() method.
 void testIndexedLabelPatternFactoryCreateNotClassSetLabelPatternInterface()
          Tests the IndexedLabelPatternFactory.createNotClassSetLabelPatternInterface() method.
 void testIndexedLabelPatternFactoryGetLargestIndex()
          Tests the IndexedLabelPatternFactory.getLargestIndex() method.
 void testIndexedLabelPatternFactoryIsValidLabel()
          Tests the IndexedLabelPatternFactory.isValidLabel() method.
 void testIndexedLabelPatternFactoryIsValidLabelPattern()
          Tests the IndexedLabelPatternFactory.isValidLabelPattern() method.
 void testIndexedLabelPatternFactoryUnmodifiableAlphabet()
          Tests the IndexedLabelPatternFactory.unmodifiableAlphabet() method.
 
Methods inherited from class laser.alphabet.labelpattern.test.AbstractIndexedLabelPatternTest
setUp
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexedLabelPatternFactoryTest

public IndexedLabelPatternFactoryTest()
Method Detail

testIndexedAlphabetFactoryCreateLabelInterface

public void testIndexedAlphabetFactoryCreateLabelInterface()
Tests the IndexedLabelPatternFactory.createLabelInterface() method. The equivalence classes for input parameters are 1) a null String 2) a String that does not represent an integer, 3) a String that represents an integer < 0, 4) a String that represents an integer >= 0, 5) a null Integer, 6) an Integer < 0, 7) an Integer >= 0, 8) an int < 0, 9) an int >= 0, 10) and an integer more than 1 > the index of the current largest IndexedLabel. We also want to ensure that flyweighting is working properly, thus executing this method twice with the same input should return two references to the same object. Also, create a number of distinct labels to make sure the repository does not become full.

This test relies on the fact that the IndexedLabelPatternFactory.getLargestIndex() method works properly.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryCreateAlphabetInterface

public void testIndexedLabelPatternFactoryCreateAlphabetInterface()
Tests the IndexedLabelPatternFactory.createAlphabetInterface() method. The equivalence classes for the input are 1) null input, 2) a single non-Integer/int parameter, 3) more than one parameter, 4) a single Integer <= 0, 5) a single Integer > 0, 6) a single int <= 0. 7) a single int > 0, and 8) no parameters.

This test relies on the fact that the IndexedLabelPatternFactory.createLabelInterface() and IndexedAlphabet.contains() methods work properly.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryGetLargestIndex

public void testIndexedLabelPatternFactoryGetLargestIndex()
Tests the IndexedLabelPatternFactory.getLargestIndex() method. Try an empty repository, then after creating each IndexedLabel with indices up to TEST_MAX_INDEX.

This method relies on the fact that the IndexedLabelPatternFactory.createLabelInterface() method works properly.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryIsValidLabel

public void testIndexedLabelPatternFactoryIsValidLabel()
Tests the IndexedLabelPatternFactory.isValidLabel() method. Try null input, a String not representing an integer, a String representing an integer < 0, and a String representing an integer >= 0.


testIndexedLabelPatternFactoryUnmodifiableAlphabet

public void testIndexedLabelPatternFactoryUnmodifiableAlphabet()
Tests the IndexedLabelPatternFactory.unmodifiableAlphabet() method. Try null input and AlphabetInterface<IndexedLabel> input.

This test relies on the fact that the IndexedAlphabetFactory.createAlphabetInterface(), IndexedAlphabetFactory.createLabelInterface(), IndexedAlphabet.add(), IndexedAlphabet.clear(), and IndexedAlphabet.getMaxIndex() methods work properly.


testIndexedLabelPatternFactoryCreateAllLabelPatternInterface

public void testIndexedLabelPatternFactoryCreateAllLabelPatternInterface()
Tests the IndexedLabelPatternFactory.createAllLabelPatternInterface() method. The method takes no input.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryCreateClassSetLabelPatternInterface

public void testIndexedLabelPatternFactoryCreateClassSetLabelPatternInterface()
Tests the IndexedLabelPatternFactory.createClassSetLabelPatternInterface() method. The method takes no input.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryCreateNotClassSetLabelPatternInterface

public void testIndexedLabelPatternFactoryCreateNotClassSetLabelPatternInterface()
Tests the IndexedLabelPatternFactory.createNotClassSetLabelPatternInterface() method. The method takes no input.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryCreateLabelPatternInterface

public void testIndexedLabelPatternFactoryCreateLabelPatternInterface()
Tests the IndexedLabelPatternFactory.createLabelPatternInterface() method. Try null input, valid String input, and invalid String input.

Note if this test fails, it invalidates the results of subsequent tests.


testIndexedLabelPatternFactoryIsValidLabelPattern

public void testIndexedLabelPatternFactoryIsValidLabelPattern()
Tests the IndexedLabelPatternFactory.isValidLabelPattern() method. Try null input, valid String input, and invalid String input.