ArbitraryBuilder

ArbitraryBuilder is a builder for arbitrary object in Fixture Monkey

Generating

Type

ArbitraryBuilder<Generate> generateBuilder = fixtureMonkey.giveMeBuilder(Generate.class);

Object

Generate generate = new Generate("test");

ArbitraryBuilder<Generate> generateBuilder = fixtureMonkey.giveMeBuilder(generate);
Generate generate = new Generate("test");

ArbitraryBuilder<Generate> generateBuilder = fixtureMonkey.giveMeBuilder(Generate.class)
    .set(generate);

Features

  • ArbitraryBuilder generated by Type always build an arbitrary object.
  • Manipulation fixed or ArbitraryBuilder generated by Object would return a fixed object.

Manipulation

Altering value

set

Altering field referenced by expression

setPostCondition

Field would be obliged to obey postCondition

size

Altering container size

fixed

Fixing object built by ArbitraryBuilder

Transforming type

map

public <U> ArbitraryBuilder<U> map(Function<T, U> mapper)

Transforming type T into U

zip

public <U, R> ArbitraryBuilder<R> zipWith(ArbitraryBuilder<U> other, BiFunction<T, U, R> combinator)

Zipping type T and U returns type R