com.atlassian.confluence
Class RandomnessHandler

java.lang.Object
  extended by com.atlassian.confluence.RandomnessHandler

public class RandomnessHandler
extends java.lang.Object

Handles the control of pseudorandomness in tests. We want to be able to reproduce the same "random" behaviour when required. We also want to be able to remove randomness completely at times.


Constructor Summary
RandomnessHandler(java.lang.String seed, java.lang.String isRandom)
          Constructor, which for convenience takes the arguments as strings to be converted, rather than the appropriate primitives.
 
Method Summary
 boolean nextBoolean()
           
 int nextInt(int limit)
           
 java.lang.String toString()
          Debugging information important so that we know what the tests were doing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RandomnessHandler

public RandomnessHandler(java.lang.String seed,
                         java.lang.String isRandom)
Constructor, which for convenience takes the arguments as strings to be converted, rather than the appropriate primitives.

Parameters:
seed - The seed with which to initialise randomness. Can be null, in which case a seed will be created based on current time.
isRandom - if not null and not true then the handler produced will be entirely non-random.
Method Detail

toString

public java.lang.String toString()
Debugging information important so that we know what the tests were doing.

Overrides:
toString in class java.lang.Object

nextBoolean

public boolean nextBoolean()
Returns:
returns true when randomness is switched off or a random boolean.

nextInt

public int nextInt(int limit)
Returns:
returns 0 when randomness is switched off or a random int less than limit.
See Also:
Random.nextInt(int)


Copyright © 2003-2014 Atlassian. All Rights Reserved.