Package net.jqwik.api.arbitraries
Interface MapArbitrary<K,V>
-
- All Superinterfaces:
Arbitrary<java.util.Map<K,V>>
,SizableArbitrary<java.util.Map<K,V>>
@API(status=MAINTAINED, since="1.3.2") public interface MapArbitrary<K,V> extends Arbitrary<java.util.Map<K,V>>, SizableArbitrary<java.util.Map<K,V>>
Fluent interface to add functionality to arbitraries that generate instances of type Map
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.jqwik.api.Arbitrary
Arbitrary.ArbitraryFacade
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MapArbitrary<K,V>
ofMaxSize(int maxSize)
Set upper size boundarymaxSize
(included).MapArbitrary<K,V>
ofMinSize(int minSize)
Set lower size boundaryminSize
(included).default MapArbitrary<K,V>
ofSize(int size)
Fix the size tosize
.MapArbitrary<K,V>
uniqueKeys(java.util.function.Function<K,java.lang.Object> by)
Add the constraint that keys of the generated map must be unique relating to an element's "feature" being extracted by applying theby
function on a map entry's key.MapArbitrary<K,V>
uniqueValues()
Add the constraint that values of the generated map must be unique, i.e. no two value must return true when being compared using Object.equals(Object).MapArbitrary<K,V>
uniqueValues(java.util.function.Function<V,java.lang.Object> by)
Add the constraint that value of the generated map must be unique relating to an element's "feature" being extracted by applying theby
function on a map entry's value.MapArbitrary<K,V>
withSizeDistribution(RandomDistribution uniform)
Set random distributiondistribution
of size of generated map.-
Methods inherited from interface net.jqwik.api.Arbitrary
allValues, array, asGeneric, collect, dontShrink, edgeCases, edgeCases, edgeCases, exhaustive, exhaustive, filter, filter, fixGenSize, flatMap, forEachValue, generator, generator, generatorWithEmbeddedEdgeCases, ignoreException, injectDuplicates, injectNull, iterator, list, map, optional, optional, sample, sampleStream, set, stream, tuple1, tuple2, tuple3, tuple4, tuple5, withoutEdgeCases
-
-
-
-
Method Detail
-
ofSize
default MapArbitrary<K,V> ofSize(int size)
Fix the size tosize
.- Specified by:
ofSize
in interfaceSizableArbitrary<K>
- Parameters:
size
- The size of the generated map- Returns:
- new arbitrary instance
-
ofMinSize
MapArbitrary<K,V> ofMinSize(int minSize)
Set lower size boundaryminSize
(included).- Specified by:
ofMinSize
in interfaceSizableArbitrary<K>
- Parameters:
minSize
- The minimum size of the generated map- Returns:
- new arbitrary instance
-
ofMaxSize
MapArbitrary<K,V> ofMaxSize(int maxSize)
Set upper size boundarymaxSize
(included).- Specified by:
ofMaxSize
in interfaceSizableArbitrary<K>
- Parameters:
maxSize
- The maximum size of the generated map- Returns:
- new arbitrary instance
-
withSizeDistribution
@API(status=EXPERIMENTAL, since="1.5.3") MapArbitrary<K,V> withSizeDistribution(RandomDistribution uniform)
Set random distributiondistribution
of size of generated map. The distribution's center is the minimum size of the generated map.- Specified by:
withSizeDistribution
in interfaceSizableArbitrary<K>
-
uniqueKeys
@API(status=MAINTAINED, since="1.4.0") MapArbitrary<K,V> uniqueKeys(java.util.function.Function<K,java.lang.Object> by)
Add the constraint that keys of the generated map must be unique relating to an element's "feature" being extracted by applying theby
function on a map entry's key. The extracted features are being compared using Object.equals(Object).The constraint can be combined with other uniqueKeys(Function) constraints.
- Returns:
- new arbitrary instance
-
uniqueValues
@API(status=MAINTAINED, since="1.4.0") MapArbitrary<K,V> uniqueValues(java.util.function.Function<V,java.lang.Object> by)
Add the constraint that value of the generated map must be unique relating to an element's "feature" being extracted by applying theby
function on a map entry's value. The extracted features are being compared using Object.equals(Object).The constraint can be combined with other uniqueValues(Function) constraints.
- Returns:
- new arbitrary instance
-
uniqueValues
@API(status=MAINTAINED, since="1.4.0") MapArbitrary<K,V> uniqueValues()
Add the constraint that values of the generated map must be unique, i.e. no two value must return true when being compared using Object.equals(Object).The constraint can be combined with other uniqueValues(Function) constraints.
- Returns:
- new arbitrary instance
-
-