Keel 2.1RC2

org.apache.commons.collections
Class TestBeanMap

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.commons.collections.BulkTest
              extended byorg.apache.commons.collections.TestObject
                  extended byorg.apache.commons.collections.TestMap
                      extended byorg.apache.commons.collections.TestBeanMap
All Implemented Interfaces:
java.lang.Cloneable, junit.framework.Test

public class TestBeanMap
extends TestMap

Test cases for BeanMap

Author:

Nested Class Summary
static class TestBeanMap.BeanWithProperties
           
 
Nested classes inherited from class org.apache.commons.collections.TestMap
TestMap.TestMapEntrySet, TestMap.TestMapKeySet, TestMap.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.TestMap
confirmed, entrySet, keySet, map, values
 
Fields inherited from class org.apache.commons.collections.TestObject
COLLECTIONS_MAJOR_VERSION
 
Fields inherited from class org.apache.commons.collections.BulkTest
verboseName
 
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().
 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[] ignoredSimpleTests()
          Returns an array of simple test names to ignore.
 boolean isAddRemoveModifiable()
          The mappings in a BeanMap are fixed on the properties the underlying bean has.
 java.util.Map makeEmptyMap()
          Return a new, empty 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 testClear()
          Need to override this method because the "clear()" method on the bean map just returns the bean properties to their default states.
 
Methods inherited from class org.apache.commons.collections.TestMap
addSampleMappings, bulkTestMapEntrySet, bulkTestMapKeySet, bulkTestMapValues, getOtherKeys, getOtherValues, isChangeable, makeObject, resetEmpty, resetFull, tearDown, testEmptyMapCompatibility, testFullMapCompatibility, testMakeMap, testMapClear, testMapContainsKey, testMapContainsValue, testMapEquals, testMapGet, testMapHashCode, testMapIsEmpty, testMapPut, testMapPutAll, testMapRemove, testMapSize, testMapToString, testSampleMappings, useDuplicateValues, useNullKey, useNullValue, verify, verifyEntrySet, verifyKeySet, verifyMap, verifyValues
 
Methods inherited from class org.apache.commons.collections.TestObject
getCanonicalEmptyCollectionName, getCanonicalFullCollectionName, getCompatibilityVersion, readExternalFormFromBytes, readExternalFormFromDisk, supportsEmptyCollections, supportsFullCollections, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDisk
 
Methods inherited from class org.apache.commons.collections.BulkTest
clone, makeSuite, toString
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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

suite

public static junit.framework.Test suite()

getSampleKeys

public java.lang.Object[] getSampleKeys()
Description copied from class: TestMap
Returns the set of keys in the mappings used to test the map. This method must return an array with the same length as TestMap.getSampleValues() and all array elements must be different. The default implementation constructs a set of String keys, and includes a single null key if TestMap.useNullKey() returns true.

Overrides:
getSampleKeys in class TestMap

getSampleValues

public java.lang.Object[] getSampleValues()
Description copied from class: TestMap
Returns the set of values in the mappings used to test the map. This method must return an array with the same length as TestMap.getSampleKeys(). The default implementation contructs a set of String values and includes a single null value if TestMap.useNullValue() returns true, and includes two values that are the same if TestMap.useDuplicateValues() returns true.

Overrides:
getSampleValues in class TestMap

getNewSampleValues

public java.lang.Object[] getNewSampleValues()
Description copied from class: TestMap
Returns a the set of values that can be used to replace the values returned from TestMap.getSampleValues(). This method must return an array with the same length as TestMap.getSampleValues(). The values returned from this method should not be the same as those returned from TestMap.getSampleValues(). The default implementation constructs a set of String values and includes a single null value if TestMap.useNullValue() returns true, and includes two values that are the same if TestMap.useDuplicateValues() returns true.

Overrides:
getNewSampleValues in class TestMap

isAddRemoveModifiable

public boolean isAddRemoveModifiable()
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.

Overrides:
isAddRemoveModifiable in class TestMap

makeFullMap

public java.util.Map makeFullMap()
Description copied from class: TestMap
Return a new, populated map. The mappings in the map should match the keys and values returned from TestMap.getSampleKeys() and TestMap.getSampleValues(). The default implementation uses makeEmptyMap() and calls #addSampleMappings() to add all the mappings to the map.

Overrides:
makeFullMap in class TestMap

makeEmptyMap

public java.util.Map makeEmptyMap()
Description copied from class: TestMap
Return a new, empty Map to be used for testing.

Specified by:
makeEmptyMap in class TestMap

testClear

public void testClear()
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.


testBeanMapClone

public void testBeanMapClone()

ignoredSimpleTests

public java.lang.String[] ignoredSimpleTests()
Description copied from class: BulkTest
Returns an array of simple test names to ignore.

If a simple test that's defined by this BulkTest or by one of its bulk test methods has a name that's in the returned array, then that simple test will not be executed.

A simple test's name is formed by taking the class name of the root BulkTest, eliminating the package name, then appending the names of any bulk test methods that were invoked to get to the simple test, and then appending the simple test method name. The method names are delimited by periods:

  TestHashMap.bulkTestEntrySet.testClear
  
is the name of one of the simple tests defined in the sample classes described above. If the sample TestHashMap class included this method:
  public String[] ignoredSimpleTests() {
      return new String[] { "TestHashMap.bulkTestEntrySet.testClear" };
  }
  
then the entry set's clear method wouldn't be tested, but the key set's clear method would.

Overrides:
ignoredSimpleTests in class BulkTest
Returns:
an array of the names of simple tests to ignore, or null if no tests should be ignored

testBeanMapPutAllWriteable

public void testBeanMapPutAllWriteable()

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.