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

Quick Search    Search Deep

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

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.commons.beanutils.BeanUtilsTestCase
All Implemented Interfaces:
junit.framework.Test

public class BeanUtilsTestCase
extends junit.framework.TestCase

Test Case for the BeanUtils class. The majority of these tests use instances of the TestBean class, so be sure to update the tests if you change the characteristics of that class.

Template for this stolen from Craigs PropertyUtilsTestCase

Note that the tests are dependant upon the static aspects (such as array sizes...) of the TestBean.java class, so ensure than all changes to TestBean are reflected here.

So far, this test case has tests for the following methods of the BeanUtils class:

Version:
$Revision: 1.29 $

Field Summary
protected  TestBean bean
          The test bean for each test.
protected  java.lang.String[] describes
          The set of properties that should be described.
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
BeanUtilsTestCase(java.lang.String name)
          Construct a new instance of this test case.
 
Method Summary
protected  void checkIntArray(int[] actual, int[] expected)
           
protected  void checkMap(java.util.Map actual, java.util.Map expected)
           
 void setUp()
          Set up instance variables required by this test case.
static junit.framework.Test suite()
          Return the tests included in this test suite.
 void tearDown()
          Tear down instance variables required by this test case.
 void testArrayPropertyConversion()
           
 void testCopyPropertiesDynaBean()
          Test the copyProperties() method from a DynaBean.
 void testCopyPropertiesMap()
          Test copyProperties() when the origin is a a Map.
 void testCopyPropertiesStandard()
          Test the copyProperties() method from a standard JavaBean.
 void testCopyPropertyByte()
          Test narrowing and widening conversions on byte.
 void testCopyPropertyDouble()
          Test narrowing and widening conversions on double.
 void testCopyPropertyFloat()
          Test narrowing and widening conversions on float.
 void testCopyPropertyInteger()
          Test narrowing and widening conversions on int.
 void testCopyPropertyLong()
          Test narrowing and widening conversions on long.
 void testCopyPropertyNestedIndexedArray()
          Test copying a property using a nested indexed array expression, with and without conversions.
 void testCopyPropertyNestedMappedMap()
          Test copying a property using a nested mapped map property.
 void testCopyPropertyNestedSimple()
          Test copying a property using a nested simple expression, with and without conversions.
 void testCopyPropertyNull()
          Test copying a null property value.
 void testCopyPropertyShort()
          Test narrowing and widening conversions on short.
 void testCopyPropertyWriteOnly()
          Test copying a new value to a write-only property, with and without conversions.
 void testDescribe()
          Test the describe() method.
 void testGetArrayProperty()
          tests the string and int arrays of TestBean
 void testGetGeneralProperty()
          tests getting a 'whatever' property
 void testGetIndexedProperty1()
          tests getting an indexed property
 void testGetIndexedProperty2()
          tests getting an indexed property
 void testGetNestedProperty()
          tests getting a nested property
 void testGetSimpleProperty()
          tests getting a 'whatever' property
 void testMappedProperty()
           
 void testPopulateArrayElements()
          Test populate() method on individual array elements.
 void testPopulateArrayProperties()
          Test populate() method on array properties as a whole.
 void testPopulateMapped()
          Test populate() on mapped properties.
 void testPopulateNested()
          Test populate() method on nested properties.
 void testPopulateScalar()
          Test populate() method on scalar properties.
 void testSeparateInstances()
          Tests that separate instances can register separate instances
 void testSetPropertyByte()
          Test narrowing and widening conversions on byte.
 void testSetPropertyDouble()
          Test narrowing and widening conversions on double.
 void testSetPropertyFloat()
          Test narrowing and widening conversions on float.
 void testSetPropertyInteger()
          Test narrowing and widening conversions on int.
 void testSetPropertyLong()
          Test narrowing and widening conversions on long.
 void testSetPropertyNull()
          Test setting a null property value.
 void testSetPropertyNullValues()
          Test calling setProperty() with null property values.
 void testSetPropertyOnPrimitiveWrappers()
          Test converting to and from primitive wrapper types.
 void testSetPropertyShort()
          Test narrowing and widening conversions on short.
 void testSetPropertyWriteOnly()
          Test setting a new value to a write-only property, with and without conversions.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bean

protected TestBean bean
The test bean for each test.


describes

protected java.lang.String[] describes
The set of properties that should be described.

Constructor Detail

BeanUtilsTestCase

public BeanUtilsTestCase(java.lang.String name)
Construct a new instance of this test case.

Method Detail

setUp

public void setUp()
Set up instance variables required by this test case.


suite

public static junit.framework.Test suite()
Return the tests included in this test suite.


tearDown

public void tearDown()
Tear down instance variables required by this test case.


testCopyPropertiesDynaBean

public void testCopyPropertiesDynaBean()
Test the copyProperties() method from a DynaBean.


testCopyPropertiesMap

public void testCopyPropertiesMap()
Test copyProperties() when the origin is a a Map.


testCopyPropertiesStandard

public void testCopyPropertiesStandard()
Test the copyProperties() method from a standard JavaBean.


testDescribe

public void testDescribe()
Test the describe() method.


testGetArrayProperty

public void testGetArrayProperty()
tests the string and int arrays of TestBean


testGetIndexedProperty1

public void testGetIndexedProperty1()
tests getting an indexed property


testGetIndexedProperty2

public void testGetIndexedProperty2()
tests getting an indexed property


testGetNestedProperty

public void testGetNestedProperty()
tests getting a nested property


testGetGeneralProperty

public void testGetGeneralProperty()
tests getting a 'whatever' property


testGetSimpleProperty

public void testGetSimpleProperty()
tests getting a 'whatever' property


testPopulateArrayElements

public void testPopulateArrayElements()
Test populate() method on individual array elements.


testPopulateArrayProperties

public void testPopulateArrayProperties()
Test populate() method on array properties as a whole.


testPopulateMapped

public void testPopulateMapped()
Test populate() on mapped properties.


testPopulateNested

public void testPopulateNested()
Test populate() method on nested properties.


testPopulateScalar

public void testPopulateScalar()
Test populate() method on scalar properties.


testSetPropertyNullValues

public void testSetPropertyNullValues()
                               throws java.lang.Exception
Test calling setProperty() with null property values.


testSetPropertyOnPrimitiveWrappers

public void testSetPropertyOnPrimitiveWrappers()
                                        throws java.lang.Exception
Test converting to and from primitive wrapper types.


testSetPropertyByte

public void testSetPropertyByte()
                         throws java.lang.Exception
Test narrowing and widening conversions on byte.


testSetPropertyDouble

public void testSetPropertyDouble()
                           throws java.lang.Exception
Test narrowing and widening conversions on double.


testSetPropertyFloat

public void testSetPropertyFloat()
                          throws java.lang.Exception
Test narrowing and widening conversions on float.


testSetPropertyInteger

public void testSetPropertyInteger()
                            throws java.lang.Exception
Test narrowing and widening conversions on int.


testSetPropertyLong

public void testSetPropertyLong()
                         throws java.lang.Exception
Test narrowing and widening conversions on long.


testSetPropertyNull

public void testSetPropertyNull()
                         throws java.lang.Exception
Test setting a null property value.


testSetPropertyShort

public void testSetPropertyShort()
                          throws java.lang.Exception
Test narrowing and widening conversions on short.


testCopyPropertyByte

public void testCopyPropertyByte()
                          throws java.lang.Exception
Test narrowing and widening conversions on byte.


testCopyPropertyDouble

public void testCopyPropertyDouble()
                            throws java.lang.Exception
Test narrowing and widening conversions on double.


testCopyPropertyFloat

public void testCopyPropertyFloat()
                           throws java.lang.Exception
Test narrowing and widening conversions on float.


testCopyPropertyInteger

public void testCopyPropertyInteger()
                             throws java.lang.Exception
Test narrowing and widening conversions on int.


testCopyPropertyLong

public void testCopyPropertyLong()
                          throws java.lang.Exception
Test narrowing and widening conversions on long.


testCopyPropertyShort

public void testCopyPropertyShort()
                           throws java.lang.Exception
Test narrowing and widening conversions on short.


testCopyPropertyNestedIndexedArray

public void testCopyPropertyNestedIndexedArray()
                                        throws java.lang.Exception
Test copying a property using a nested indexed array expression, with and without conversions.


testCopyPropertyNestedMappedMap

public void testCopyPropertyNestedMappedMap()
                                     throws java.lang.Exception
Test copying a property using a nested mapped map property.


testCopyPropertyNestedSimple

public void testCopyPropertyNestedSimple()
                                  throws java.lang.Exception
Test copying a property using a nested simple expression, with and without conversions.


testCopyPropertyNull

public void testCopyPropertyNull()
                          throws java.lang.Exception
Test copying a null property value.


testCopyPropertyWriteOnly

public void testCopyPropertyWriteOnly()
                               throws java.lang.Exception
Test copying a new value to a write-only property, with and without conversions.


testSetPropertyWriteOnly

public void testSetPropertyWriteOnly()
                              throws java.lang.Exception
Test setting a new value to a write-only property, with and without conversions.


testSeparateInstances

public void testSeparateInstances()
                           throws java.lang.Exception
Tests that separate instances can register separate instances


testArrayPropertyConversion

public void testArrayPropertyConversion()
                                 throws java.lang.Exception

checkIntArray

protected void checkIntArray(int[] actual,
                             int[] expected)

checkMap

protected void checkMap(java.util.Map actual,
                        java.util.Map expected)

testMappedProperty

public void testMappedProperty()
                        throws java.lang.Exception