org.apache.commons.collections.keyvalue
Class AbstractTestMapEntry

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.commons.collections.keyvalue.AbstractTestMapEntry
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractTestMapEntry
extends junit.framework.TestCase

Abstract tests that can be extended to test any Map.Entry implementation. Subclasses must implement makeMapEntry(Object, Object) to return a new Map.Entry of the type being tested. Subclasses must also implement testConstructors() to test the constructors of the Map.Entry type being tested.

Since:
Commons Collections 3.0

Field Summary
protected  java.lang.String key
           
protected  java.lang.String value
           
 
Constructor Summary
AbstractTestMapEntry(java.lang.String testName)
          JUnit constructor.
 
Method Summary
 java.util.Map.Entry makeKnownMapEntry()
          Makes a Map.Entry of a type that's known to work correctly.
 java.util.Map.Entry makeKnownMapEntry(java.lang.Object key, java.lang.Object value)
          Makes a Map.Entry of a type that's known to work correctly.
 java.util.Map.Entry makeMapEntry()
          Make an instance of Map.Entry with the default (null) key and value.
abstract  java.util.Map.Entry makeMapEntry(java.lang.Object key, java.lang.Object value)
          Make an instance of Map.Entry with the specified key and value.
 void testAccessorsAndMutators()
           
abstract  void testConstructors()
          Subclasses should provide tests for their constructors.
 void testEqualsAndHashCode()
           
 void testSelfReferenceHandling()
          Subclasses should override this method to test the desired behaviour of the class with respect to handling of self-references.
 void testToString()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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
 

Field Detail

key

protected final java.lang.String key
See Also:
Constant Field Values

value

protected final java.lang.String value
See Also:
Constant Field Values
Constructor Detail

AbstractTestMapEntry

public AbstractTestMapEntry(java.lang.String testName)
JUnit constructor.

Parameters:
testName - the test name
Method Detail

makeMapEntry

public java.util.Map.Entry makeMapEntry()
Make an instance of Map.Entry with the default (null) key and value. This implementation simply calls makeMapEntry(Object, Object) with null for key and value. Subclasses can override this method if desired.


makeMapEntry

public abstract java.util.Map.Entry makeMapEntry(java.lang.Object key,
                                                 java.lang.Object value)
Make an instance of Map.Entry with the specified key and value. Subclasses should override this method to return a Map.Entry of the type being tested.


makeKnownMapEntry

public java.util.Map.Entry makeKnownMapEntry()
Makes a Map.Entry of a type that's known to work correctly.


makeKnownMapEntry

public java.util.Map.Entry makeKnownMapEntry(java.lang.Object key,
                                             java.lang.Object value)
Makes a Map.Entry of a type that's known to work correctly.


testAccessorsAndMutators

public void testAccessorsAndMutators()

testSelfReferenceHandling

public void testSelfReferenceHandling()
Subclasses should override this method to test the desired behaviour of the class with respect to handling of self-references.


testConstructors

public abstract void testConstructors()
Subclasses should provide tests for their constructors.


testEqualsAndHashCode

public void testEqualsAndHashCode()

testToString

public void testToString()


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.