| org.apache.commons.beanutils.converters.BooleanArrayConverterTestCase
BooleanArrayConverterTestCase | public class BooleanArrayConverterTestCase extends TestCase (Code) | | Test conversions of String[]->boolean[] and String->boolean[].
Note that the tests here don't rigorously test conversions of individual
strings to booleans, as the BooleanArrayConverter class uses a
BooleanConverter instance to do those conversions, and the BooleanConverter
class has its own unit tests. Here, the tests focus on the array-related
behaviour.
|
Method Summary | |
public void | testAdditionalStrings() Check that the user can specify non-standard true/false values by
providing a customised BooleanConverter. | public void | testElementDefault() Check that when a custom BooleanConverter is used, and that converter
has a (per-element) default, then that element (and just that element)
is assigned the default value. | public void | testInvalidElementWithDefault() Check that when one of the elements in a comma-separated string is not
a valid boolean, and there is a default value then the default value
is returned. | public void | testInvalidElementWithoutDefault() Check that when one of the elements in a comma-separated string is not
a valid boolean, and there is no default value then an exception is thrown. | public void | testInvalidStringWithDefault() Check that when the input string cannot be split into a String[], and
there is a default value then that default is returned. | public void | testInvalidStringWithoutDefault() Check that when the input string cannot be split into a String[], and
there is no default value then an exception is thrown. | public void | testRegistration() Check that registration of a custom converter works. | public void | testStandardStringArrayConversion() Check that an object of type String[] with valid boolean string
values gets converted nicely. | public void | testStandardStringConversion() Check that an object whose toString method returns a list of boolean
values gets converted nicely. |
STANDARD_FALSES | final public static String[] STANDARD_FALSES(Code) | | |
STANDARD_TRUES | final public static String[] STANDARD_TRUES(Code) | | |
BooleanArrayConverterTestCase | public BooleanArrayConverterTestCase(String name)(Code) | | |
testAdditionalStrings | public void testAdditionalStrings()(Code) | | Check that the user can specify non-standard true/false values by
providing a customised BooleanConverter.
|
testElementDefault | public void testElementDefault()(Code) | | Check that when a custom BooleanConverter is used, and that converter
has a (per-element) default, then that element (and just that element)
is assigned the default value.
With the standard BooleanArrayConverter, if any of the elements
in the array are bad, then the array-wide default value is returned.
However by specifying a custom BooleanConverter which has a per-element
default, the unrecognised elements get that per-element default but the
others are converted as expected.
|
testInvalidElementWithDefault | public void testInvalidElementWithDefault()(Code) | | Check that when one of the elements in a comma-separated string is not
a valid boolean, and there is a default value then the default value
is returned.
Note that the default value is for the complete array object returned,
not for the failed element.
|
testInvalidElementWithoutDefault | public void testInvalidElementWithoutDefault()(Code) | | Check that when one of the elements in a comma-separated string is not
a valid boolean, and there is no default value then an exception is thrown.
|
testInvalidStringWithDefault | public void testInvalidStringWithDefault()(Code) | | Check that when the input string cannot be split into a String[], and
there is a default value then that default is returned.
|
testInvalidStringWithoutDefault | public void testInvalidStringWithoutDefault()(Code) | | Check that when the input string cannot be split into a String[], and
there is no default value then an exception is thrown.
|
testRegistration | public void testRegistration()(Code) | | Check that registration of a custom converter works.
|
testStandardStringArrayConversion | public void testStandardStringArrayConversion()(Code) | | Check that an object of type String[] with valid boolean string
values gets converted nicely.
|
testStandardStringConversion | public void testStandardStringConversion()(Code) | | Check that an object whose toString method returns a list of boolean
values gets converted nicely.
|
|
|