net.sf.qualitytest.blueprint
Class Create

java.lang.Object
  extended by net.sf.qualitytest.blueprint.Create

public final class Create
extends Object

A utility class to have a more readable API. This class holds possible creation strategies.

Author:
Dominik Seichter

Method Summary
static
<T> CreationStrategy<T>
nil()
          Always create null.
static CreationStrategy<Boolean> randomBoolean()
          Create a random boolean (true or false).
static CreationStrategy<Byte> randomByte()
          Create a random byte.
static CreationStrategy<Character> randomChar()
          Create a random character.
static CreationStrategy<Double> randomDouble()
          Create a random double.
static CreationStrategy<Enum<?>> randomEnum()
          Create a random enum constant whenever an enumeration is requested.
static CreationStrategy<Float> randomFloat()
          Create a random float.
static CreationStrategy<Integer> randomInteger()
          Create a random integer.
static CreationStrategy<Long> randomLong()
          Create a random long.
static CreationStrategy<Short> randomShort()
          Create a random short.
static
<T> CreationStrategy<T>
value(T value)
          Always create this value, when requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nil

public static <T> CreationStrategy<T> nil()
Always create null.

Returns:
CreationStrategy which always returns null.

randomBoolean

public static CreationStrategy<Boolean> randomBoolean()
Create a random boolean (true or false).

Returns:
CreationStrategy which always returns a random boolean.

randomByte

public static CreationStrategy<Byte> randomByte()
Create a random byte.

Returns:
CreationStrategy which always returns a random byte.

randomChar

public static CreationStrategy<Character> randomChar()
Create a random character.

Returns:
CreationStrategy which always returns a random character.

randomDouble

public static CreationStrategy<Double> randomDouble()
Create a random double.

Returns:
CreationStrategy which always returns a random double.

randomEnum

public static CreationStrategy<Enum<?>> randomEnum()
Create a random enum constant whenever an enumeration is requested.

Returns:
CreationStrategy which always returns a random enum constact.

randomFloat

public static CreationStrategy<Float> randomFloat()
Create a random float.

Returns:
CreationStrategy which always returns a random float.

randomInteger

public static CreationStrategy<Integer> randomInteger()
Create a random integer.

Returns:
CreationStrategy which always returns a random integer.

randomLong

public static CreationStrategy<Long> randomLong()
Create a random long.

Returns:
CreationStrategy which always returns a random long.

randomShort

public static CreationStrategy<Short> randomShort()
Create a random short.

Returns:
CreationStrategy which always returns a random short.

value

public static <T> CreationStrategy<T> value(@Nonnull
                                            T value)
Always create this value, when requested.

Parameters:
value - a value
Returns:
CreationStrategy which always returns value.


Copyright © 2012-2013. All Rights Reserved.