public class

RandomnessHandler

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.RandomnessHandler

Class Overview

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.

Summary

Public Constructors
RandomnessHandler(String seed, String isRandom)
Constructor, which for convenience takes the arguments as strings to be converted, rather than the appropriate primatives.
Public Methods
boolean nextBoolean()
int nextInt(int limit)
String toString()
Debugging information important so that we know what the tests were doing.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RandomnessHandler (String seed, String isRandom)

Constructor, which for convenience takes the arguments as strings to be converted, rather than the appropriate primatives.

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.

Public Methods

public boolean nextBoolean ()

Returns
  • returns true when randomness is switched off or a random boolean.

public int nextInt (int limit)

Returns
  • returns 0 when randomness is switched off or a random int less than limit.
See Also

public String toString ()

Debugging information important so that we know what the tests were doing.