Skip to content

Creating a MockNeat object

Andrei Ciobanu edited this page Feb 24, 2017 · 6 revisions

In order to start creating random data for your application the first thing is to create or to obtain an existing instance of the MockNeat class. This is the main class of the library and the source of all evil.

There are a few ways you can obtain this:

  • Re-use the default instance of a MockNeat class that internally uses a ThreadLocalRandom implementation from the Java library.
MockNeat mock = MockNeat.threadLocal();
  • Re-use the default instance of a MockNeat class that internally uses a SecureRandom implementation from the Java library.
MockNeat mock = MockNeat.secure();
  • Re-use the default instance of a MockNeat class that internally uses the old Random class from the Java library.
MockNeat mock = MockNeat.old();
  • Create a new instance of the MockNeat class using a predefined RandomType and a seed:
Long seed = 123l;
MockNeat mock = new MockNeat(RandomType.SECURE, seed);
Clone this wiki locally