Skip to content

SizedDomain

class in io.proptastic

abstract sealed class SizedDomain<T, S>

A collection’s domain, sized by bounds: ofSize(atLeast(1), atMost(50)), ofSize(atMost(50)), ofSize(n) or nonEmpty(). Without a size, a collection is 0 to MAX long and usually short.

Methods

averageSize

S averageSize(double n)

About n elements on average, within the bounds: lists(…).averageSize(20). Without it, a collection is its minimum and about 7 more. The longest bound still cuts a draw off, so an average near it comes out a little shorter.

ofSize

S ofSize(int n)

Exactly n elements.

ofSize

S ofSize(Bound... bounds)

Sized by one or two bounds: ofSize(atLeast(1), atMost(50)), ofSize(atMost(9)).

nonEmpty

S nonEmpty()

At least one element.

Privacy