uk.co.jemos.podam.api
Class RandomDataProviderStrategy

java.lang.Object
  extended by uk.co.jemos.podam.api.RandomDataProviderStrategy
All Implemented Interfaces:
DataProviderStrategy

public class RandomDataProviderStrategy
extends Object
implements DataProviderStrategy

Default implementation of a DataProviderStrategy

This default implementation returns values based on a random generator. Don't use this implementation if you seek deterministic values

All values returned by this implementation are different from zero.

This implementation is a Singleton

Author:
mtedone

Field Summary
private static org.apache.log4j.Logger LOG
          Application logger
private static Random RANDOM
          A RANDOM generator
private static RandomDataProviderStrategy SINGLETON
          The singleton instance of this implementation
 
Constructor Summary
private RandomDataProviderStrategy()
          Implementation of the Singleton pattern
 
Method Summary
 Boolean getBoolean()
          It returns a boolean/Boolean value.
 Byte getByte()
          It returns a byte/Byte value.
 Byte getByteInRange(byte minValue, byte maxValue)
          It returns a byte/Byte within min and max value (included).
 Character getCharacter()
          It returns a char/Character value.
 Character getCharacterInRange(char minValue, char maxValue)
          It returns a char/Character value between min and max value (included).
 Double getDouble()
          It returns a double/Double value
 Double getDoubleInRange(double minValue, double maxValue)
          It returns a double/Double value between min and max value (included).
 Float getFloat()
          It returns a float/Float value.
 Float getFloatInRange(float minValue, float maxValue)
          It returns a float/Float value between min and max value (included).
static RandomDataProviderStrategy getInstance()
          Implementation of the Singleton pattern
 Integer getInteger()
          It returns an int/Integer value.
 int getIntegerInRange(int minValue, int maxValue)
          It returns an int/Integer value between min and max value (included).
 Long getLong()
          It returns a long/Long value.
 Long getLongInRange(long minValue, long maxValue)
          It returns a long/Long value between min and max value (included).
 Short getShort()
          It returns a short/Short value.
 Short getShortInRange(short minValue, short maxValue)
          It returns a short/Short value between min and max value (included).
 String getStringOfLength(int length)
          It returns a String of length characters.
 String getStringValue()
          It returns a string value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM

private static final Random RANDOM
A RANDOM generator


SINGLETON

private static final RandomDataProviderStrategy SINGLETON
The singleton instance of this implementation


LOG

private static final org.apache.log4j.Logger LOG
Application logger

Constructor Detail

RandomDataProviderStrategy

private RandomDataProviderStrategy()
Implementation of the Singleton pattern

Method Detail

getInstance

public static RandomDataProviderStrategy getInstance()
Implementation of the Singleton pattern

Returns:
A singleton instance of this class

getBoolean

public Boolean getBoolean()
It returns a boolean/Boolean value.

Specified by:
getBoolean in interface DataProviderStrategy

getByte

public Byte getByte()
It returns a byte/Byte value.

Specified by:
getByte in interface DataProviderStrategy

getByteInRange

public Byte getByteInRange(byte minValue,
                           byte maxValue)
It returns a byte/Byte within min and max value (included).

Specified by:
getByteInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A byte/Byte within min and max value (included).

getCharacter

public Character getCharacter()
It returns a char/Character value.

Specified by:
getCharacter in interface DataProviderStrategy

getCharacterInRange

public Character getCharacterInRange(char minValue,
                                     char maxValue)
It returns a char/Character value between min and max value (included).

Specified by:
getCharacterInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A char/Character value between min and max value (included).

getDouble

public Double getDouble()
It returns a double/Double value

Specified by:
getDouble in interface DataProviderStrategy

getDoubleInRange

public Double getDoubleInRange(double minValue,
                               double maxValue)
It returns a double/Double value between min and max value (included).

Specified by:
getDoubleInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A double/Double value between min and max value (included)

getFloat

public Float getFloat()
It returns a float/Float value.

Specified by:
getFloat in interface DataProviderStrategy

getFloatInRange

public Float getFloatInRange(float minValue,
                             float maxValue)
It returns a float/Float value between min and max value (included).

Specified by:
getFloatInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A float/Float value between min and max value (included).

getInteger

public Integer getInteger()
It returns an int/Integer value.

Specified by:
getInteger in interface DataProviderStrategy

getIntegerInRange

public int getIntegerInRange(int minValue,
                             int maxValue)
It returns an int/Integer value between min and max value (included).

Specified by:
getIntegerInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
An int/Integer value between min and max value (included).

getLong

public Long getLong()
It returns a long/Long value.

Specified by:
getLong in interface DataProviderStrategy

getLongInRange

public Long getLongInRange(long minValue,
                           long maxValue)
It returns a long/Long value between min and max value (included).

Specified by:
getLongInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A long/Long value between min and max value (included).

getShort

public Short getShort()
It returns a short/Short value.

Specified by:
getShort in interface DataProviderStrategy

getShortInRange

public Short getShortInRange(short minValue,
                             short maxValue)
It returns a short/Short value between min and max value (included).

Specified by:
getShortInRange in interface DataProviderStrategy
Parameters:
minValue - The minimum value for the returned value
maxValue - The maximum value for the returned value
Returns:
A short/Short value between min and max value (included).

getStringValue

public String getStringValue()
It returns a string value

Specified by:
getStringValue in interface DataProviderStrategy

getStringOfLength

public String getStringOfLength(int length)
It returns a String of length characters.

Specified by:
getStringOfLength in interface DataProviderStrategy
Parameters:
length - The number of characters required in the returned String
Returns:
A String of length characters

Jemos 2002 - 2011: All Rights Reserved. Podam runs under the MIT license

Copyright © 2011. All Rights Reserved.