java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.commons.collections.BulkTest
org.apache.commons.collections.AbstractTestObject
org.apache.commons.collections.map.AbstractTestMap
org.apache.commons.beanutils.TestBeanMap
- All Implemented Interfaces:
- java.lang.Cloneable, junit.framework.Test
- public class TestBeanMap
- extends org.apache.commons.collections.map.AbstractTestMap
Test cases for BeanMap
- Version:
- $Revision: 1.1 $ $Date: 2004/05/11 22:46:26 $
| Nested classes inherited from class org.apache.commons.collections.map.AbstractTestMap |
org.apache.commons.collections.map.AbstractTestMap.TestMapEntrySet, org.apache.commons.collections.map.AbstractTestMap.TestMapKeySet, org.apache.commons.collections.map.AbstractTestMap.TestMapValues |
| Fields inherited from class org.apache.commons.collections.BulkTest |
|
| Fields inherited from class junit.framework.TestCase |
|
| Methods inherited from class org.apache.commons.collections.map.AbstractTestMap |
addSampleMappings, bulkTestMapEntrySet, bulkTestMapKeySet, bulkTestMapValues, cloneMapEntry, getCompatibilityVersion, getOtherKeys, getOtherNonNullStringElements, getOtherValues, isAllowDuplicateValues, isAllowNullKey, isAllowNullValue, isGetStructuralModify, isPutChangeSupported, isSetValueSupported, isSubMapViewsSerializable, makeConfirmedMap, makeObject, resetEmpty, resetFull, tearDown, testEmptyMapCompatibility, testEntrySetClearChangesMap, testEntrySetContains1, testEntrySetContains2, testEntrySetContains3, testEntrySetRemove1, testEntrySetRemove2, testEntrySetRemove3, testFullMapCompatibility, testKeySetClearChangesMap, testKeySetRemoveChangesMap, testMakeMap, testMapContainsKey, testMapContainsValue, testMapEquals, testMapGet, testMapHashCode, testMapIsEmpty, testMapPutAll, testMapPutNullKey, testMapPutNullValue, testMapRemove, testMapSize, testMapToString, testSampleMappings, testValuesClearChangesMap, testValuesRemoveChangesMap, verify, verifyEntrySet, verifyKeySet, verifyMap |
| Methods inherited from class org.apache.commons.collections.AbstractTestObject |
getCanonicalEmptyCollectionName, getCanonicalFullCollectionName, isEqualsCheckable, isTestSerialization, readExternalFormFromBytes, readExternalFormFromDisk, skipSerializedCanonicalTests, supportsEmptyCollections, supportsFullCollections, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testEqualsNull, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSerializeDeserializeThenCompare, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDisk |
| 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 |
objectInFullMap
private java.lang.Object objectInFullMap
- An object value that will be stored in the bean map as a value. Need
to save this externally so that we can make sure the object instances
are equivalent since getSampleValues() would otherwise construct a new
and different Object each time.
TestBeanMap
public TestBeanMap(java.lang.String testName)
main
public static void main(java.lang.String[] args)
suite
public static junit.framework.Test suite()
getSampleKeys
public java.lang.Object[] getSampleKeys()
- Description copied from class:
org.apache.commons.collections.map.AbstractTestMap
- Returns the set of keys in the mappings used to test the map. This
method must return an array with the same length as AbstractTestMap.getSampleValues()>
AbstractTestMap.getSampleValues() 55 and all array elements must be different. The
default implementation constructs a set of String keys, and includes a
single null key if AbstractTestMap.isAllowNullKey()>AbstractTestMap.isAllowNullKey() 55 returns true.
getSampleValues
public java.lang.Object[] getSampleValues()
- Description copied from class:
org.apache.commons.collections.map.AbstractTestMap
- Returns the set of values in the mappings used to test the map. This
method must return an array with the same length as
AbstractTestMap.getSampleKeys()>
AbstractTestMap.getSampleKeys() 55 . The default implementation constructs a set of
String values and includes a single null value if
AbstractTestMap.isAllowNullValue()>AbstractTestMap.isAllowNullValue() 55 returns true, and includes
two values that are the same if AbstractTestMap.isAllowDuplicateValues()>AbstractTestMap.isAllowDuplicateValues() 55 returns
true.
getNewSampleValues
public java.lang.Object[] getNewSampleValues()
- Description copied from class:
org.apache.commons.collections.map.AbstractTestMap
- Returns a the set of values that can be used to replace the values
returned from AbstractTestMap.getSampleValues()>
AbstractTestMap.getSampleValues() 55 . This method must return an
array with the same length as AbstractTestMap.getSampleValues()>AbstractTestMap.getSampleValues() 55 . The values
returned from this method should not be the same as those returned from
AbstractTestMap.getSampleValues()>AbstractTestMap.getSampleValues() 55 . The default implementation constructs a
set of String values and includes a single null value if
AbstractTestMap.isAllowNullValue()>AbstractTestMap.isAllowNullValue() 55 returns true, and includes two values
that are the same if AbstractTestMap.isAllowDuplicateValues()>AbstractTestMap.isAllowDuplicateValues() 55 returns
true.
verifyValues
public void verifyValues()
- Values is a dead copy in BeanMap, so refresh each time.
isPutAddSupported
public boolean isPutAddSupported()
- The mappings in a BeanMap are fixed on the properties the underlying
bean has. Adding and removing mappings is not possible, thus this
method is overridden to return false.
isRemoveSupported
public boolean isRemoveSupported()
- The mappings in a BeanMap are fixed on the properties the underlying
bean has. Adding and removing mappings is not possible, thus this
method is overridden to return false.
makeFullMap
public java.util.Map makeFullMap()
- Description copied from class:
org.apache.commons.collections.map.AbstractTestMap
- Return a new, populated map. The mappings in the map should match the
keys and values returned from AbstractTestMap.getSampleKeys()>
AbstractTestMap.getSampleKeys() 55 and
AbstractTestMap.getSampleValues()>AbstractTestMap.getSampleValues() 55 . The default implementation uses makeEmptyMap()
and calls AbstractTestMap.addSampleMappings(java.util.Map)>AbstractTestMap.addSampleMappings(java.util.Map) 55 to add all the mappings to the
map.
makeEmptyMap
public java.util.Map makeEmptyMap()
- Description copied from class:
org.apache.commons.collections.map.AbstractTestMap
- Return a new, empty java.util.Map to be used for testing.
ignoredTests
public java.lang.String[] ignoredTests()
testMapClear
public void testMapClear()
- Need to override this method because the "clear()" method on the bean
map just returns the bean properties to their default states. It does
not actually remove the mappings as per the map contract. The default
testClear() methods checks that the clear method throws an
UnsupportedOperationException since this class is not add/remove
modifiable. In our case though, we do not always throw that exception.
testMapPut
public void testMapPut()
- Need to override this method because the "put()" method on the bean
doesn't work for this type of Map.
testBeanMapClone
public void testBeanMapClone()
testBeanMapPutAllWriteable
public void testBeanMapPutAllWriteable()
testMethodAccessor
public void testMethodAccessor()
throws java.lang.Exception
testMethodMutator
public void testMethodMutator()
throws java.lang.Exception