org.apache.commons.collections.keyvalue

Class AbstractTestMapEntry

public abstract class AbstractTestMapEntry extends TestCase

Abstract tests that can be extended to test any Map.Entry implementation. Subclasses must implement AbstractTestMapEntry 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 Stringkey
protected Stringvalue
Constructor Summary
AbstractTestMapEntry(String testName)
JUnit constructor.
Method Summary
EntrymakeKnownMapEntry()
Makes a Map.Entry of a type that's known to work correctly.
EntrymakeKnownMapEntry(Object key, Object value)
Makes a Map.Entry of a type that's known to work correctly.
EntrymakeMapEntry()
Make an instance of Map.Entry with the default (null) key and value.
abstract EntrymakeMapEntry(Object key, Object value)
Make an instance of Map.Entry with the specified key and value.
voidtestAccessorsAndMutators()
abstract voidtestConstructors()
Subclasses should provide tests for their constructors.
voidtestEqualsAndHashCode()
voidtestSelfReferenceHandling()
Subclasses should override this method to test the desired behaviour of the class with respect to handling of self-references.
voidtestToString()

Field Detail

key

protected final String key

value

protected final String value

Constructor Detail

AbstractTestMapEntry

public AbstractTestMapEntry(String testName)
JUnit constructor.

Parameters: testName the test name

Method Detail

makeKnownMapEntry

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

makeKnownMapEntry

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

makeMapEntry

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

makeMapEntry

public abstract Entry makeMapEntry(Object key, 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.

testAccessorsAndMutators

public void testAccessorsAndMutators()

testConstructors

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

testEqualsAndHashCode

public void testEqualsAndHashCode()

testSelfReferenceHandling

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

testToString

public void testToString()
Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.