ArrayLength
Matches an Array whose length is within the specified range (or 1-infinity if not specified).
- Typescript
- Java
import { matchers } from '@contract-case/case-definition-dsl'
new matchers.arrays.ArrayLength(options: ArrayLengthOptions)
Parameters
Name | Type | Description |
---|---|---|
options | matchers.ArrayLengthOptions | An ArrayLengthOptions object with optional minLength (default 1) and maxLength (default infinity) properties. |
import io.contract_testing.contractcase.definitions.matchers.arrays.ArrayLength;
ArrayLength.Builder.create()
// .maxLength(java.lang.Number)
// .minLength(java.lang.Number)
.build();
Parameters
Name | Type | Description |
---|---|---|
maxLength | java.lang.Number | The maximum length for the array - must be greater than minimum length. Default infinity. |
minLength | java.lang.Number | The minimum length for the array - must be greater than zero, otherwise empty arrays pass and you wouldn't be testing the array contents. Default 1. |