Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.beanutils
Class TestBeanMap  view TestBeanMap download TestBeanMap.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.commons.collections.BulkTest
              extended byorg.apache.commons.collections.AbstractTestObject
                  extended byorg.apache.commons.collections.map.AbstractTestMap
                      extended byorg.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 Class Summary
static class TestBeanMap.BeanWithProperties
           
 
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
 
Field Summary
private  java.lang.Object objectInFullMap
          An object value that will be stored in the bean map as a value.
 
Fields inherited from class org.apache.commons.collections.map.AbstractTestMap
confirmed, entrySet, keySet, map, values
 
Fields inherited from class org.apache.commons.collections.AbstractTestObject
COLLECTIONS_MAJOR_VERSION
 
Fields inherited from class org.apache.commons.collections.BulkTest
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
TestBeanMap(java.lang.String testName)
           
 
Method Summary
 java.lang.Object[] getNewSampleValues()
          Returns a the set of values that can be used to replace the values returned from getSampleValues() 55 .
 java.lang.Object[] getSampleKeys()
          Returns the set of keys in the mappings used to test the map.
 java.lang.Object[] getSampleValues()
          Returns the set of values in the mappings used to test the map.
 java.lang.String[] ignoredTests()
           
 boolean isPutAddSupported()
          The mappings in a BeanMap are fixed on the properties the underlying bean has.
 boolean isRemoveSupported()
          The mappings in a BeanMap are fixed on the properties the underlying bean has.
static void main(java.lang.String[] args)
           
 java.util.Map makeEmptyMap()
          Return a new, empty java.util.Map to be used for testing.
 java.util.Map makeFullMap()
          Return a new, populated map.
static junit.framework.Test suite()
           
 void testBeanMapClone()
           
 void testBeanMapPutAllWriteable()
           
 void testMapClear()
          Need to override this method because the "clear()" method on the bean map just returns the bean properties to their default states.
 void testMapPut()
          Need to override this method because the "put()" method on the bean doesn't work for this type of Map.
 void testMethodAccessor()
           
 void testMethodMutator()
           
 void verifyValues()
          Values is a dead copy in BeanMap, so refresh each time.
 
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 org.apache.commons.collections.BulkTest
clone, ignoredSimpleTests, makeSuite, toString
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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.

Constructor Detail

TestBeanMap

public TestBeanMap(java.lang.String testName)
Method Detail

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