net.sourceforge.pmd.properties
Class AbstractPropertyDescriptorTester

java.lang.Object
  extended by net.sourceforge.pmd.properties.AbstractPropertyDescriptorTester
Direct Known Subclasses:
BooleanPropertyTest, CharacterPropertyTest, DoublePropertyTest, EnumeratedPropertyTest, FloatPropertyTest, IntegerPropertyTest, MethodPropertyTest, StringPropertyTest, TypePropertyTest

public abstract class AbstractPropertyDescriptorTester
extends Object

Base functionality for all concrete subclasses that evaluate type-specific property descriptors. Checks for error conditions during construction, error value detection, serialization, etc.

Author:
Brian Remedios

Field Summary
static String allChars
           
static String alphaChars
           
static String alphaNumericChars
           
static String digitChars
           
static String punctuationChars
           
protected  String typeName
           
static String whitespaceChars
           
 
Constructor Summary
AbstractPropertyDescriptorTester(String typeName)
           
 
Method Summary
protected abstract  PropertyDescriptor createBadProperty(boolean multiValue)
          Attempt to create a property with faulty configuration values.
protected abstract  Object createBadValue(int count)
          Return a value(s) that is known to be faulty per the general scope of the descriptor.
protected abstract  PropertyDescriptor createProperty(boolean multiValue)
          Creates and returns a properly configured property descriptor.
protected abstract  Object createValue(int count)
          Return a legal value(s) per the general scope of the descriptor.
protected static char[] filter(char[] chars, char removeChar)
          Method filter.
protected  PropertyDescriptorFactory getMultiFactory()
           
protected  PropertyDescriptorFactory getSingleFactory()
           
static boolean randomBool()
           
static char randomChar(char[] characters)
          Method randomChar.
static Object randomChoice(Object[] items)
          Method randomChoice.
static double randomDouble(double min, double max)
          Method randomDouble.
static float randomFloat(float min, float max)
          Method randomFloat.
static int randomInt()
          Method randomInt.
static int randomInt(int min, int max)
          Method randomInt.
static String randomString(int length)
           
 void testAsDelimitedString()
           
 void testConstructors()
           
 void testErrorFor()
           
 void testErrorForBad()
           
 void testFactoryMultiValueCustomDelimiter()
           
 void testFactoryMultiValueDefaultDelimiter()
           
 void testFactorySingleValue()
           
 void testType()
           
 void testValueFrom()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeName

protected final String typeName

punctuationChars

public static final String punctuationChars
See Also:
Constant Field Values

whitespaceChars

public static final String whitespaceChars
See Also:
Constant Field Values

digitChars

public static final String digitChars
See Also:
Constant Field Values

alphaChars

public static final String alphaChars
See Also:
Constant Field Values

alphaNumericChars

public static final String alphaNumericChars
See Also:
Constant Field Values

allChars

public static final String allChars
See Also:
Constant Field Values
Constructor Detail

AbstractPropertyDescriptorTester

public AbstractPropertyDescriptorTester(String typeName)
Method Detail

createValue

protected abstract Object createValue(int count)
Return a legal value(s) per the general scope of the descriptor.

Parameters:
count - int
Returns:
Object

createBadValue

protected abstract Object createBadValue(int count)
Return a value(s) that is known to be faulty per the general scope of the descriptor.

Parameters:
count - int
Returns:
Object

createProperty

protected abstract PropertyDescriptor createProperty(boolean multiValue)
Creates and returns a properly configured property descriptor.

Parameters:
multiValue - boolean
Returns:
PropertyDescriptor

createBadProperty

protected abstract PropertyDescriptor createBadProperty(boolean multiValue)
Attempt to create a property with faulty configuration values. This method should throw an IllegalArgumentException if done correctly.

Parameters:
multiValue - boolean
Returns:
PropertyDescriptor

getSingleFactory

protected final PropertyDescriptorFactory getSingleFactory()

getMultiFactory

protected final PropertyDescriptorFactory getMultiFactory()

testFactorySingleValue

public void testFactorySingleValue()

testFactoryMultiValueDefaultDelimiter

public void testFactoryMultiValueDefaultDelimiter()

testFactoryMultiValueCustomDelimiter

public void testFactoryMultiValueCustomDelimiter()

testConstructors

public void testConstructors()

testAsDelimitedString

public void testAsDelimitedString()

testValueFrom

public void testValueFrom()

testErrorFor

public void testErrorFor()

testErrorForBad

public void testErrorForBad()

testType

public void testType()

randomBool

public static boolean randomBool()

randomInt

public static int randomInt()
Method randomInt.

Returns:
int

randomInt

public static int randomInt(int min,
                            int max)
Method randomInt.

Parameters:
min - int
max - int
Returns:
int

randomString

public static String randomString(int length)

randomFloat

public static float randomFloat(float min,
                                float max)
Method randomFloat.

Parameters:
min - float
max - float
Returns:
float

randomDouble

public static double randomDouble(double min,
                                  double max)
Method randomDouble.

Parameters:
min - double
max - double
Returns:
double

randomChar

public static char randomChar(char[] characters)
Method randomChar.

Parameters:
characters - char[]
Returns:
char

randomChoice

public static Object randomChoice(Object[] items)
Method randomChoice.

Parameters:
items - Object[]
Returns:
Object

filter

protected static final char[] filter(char[] chars,
                                     char removeChar)
Method filter.

Parameters:
chars - char[]
removeChar - char
Returns:
char[]


Copyright © 2002–2015 InfoEther. All rights reserved.