Class MetadataBuilder
-
- All Implemented Interfaces:
public class MetadataBuilder
-
-
Method Summary
Modifier and Type Method Description final Map<String, Object>
getValues()
final MatchingRuleCategory
getMatchers()
final Map<String, Generator>
getGenerators()
final MetadataBuilder
add(String key, Object value)
Add an entry to the metadata final MetadataBuilder
like(String name, Object example)
Attribute that must be the same type as the example final MetadataBuilder
numberType(String name, Number number)
Attribute that can be any number final MetadataBuilder
integerType(String name, Long number)
Attribute that must be an integer final MetadataBuilder
integerType(String name, Integer number)
Attribute that must be an integer final MetadataBuilder
decimalType(String name, BigDecimal number)
Attribute that must be a decimalType value final MetadataBuilder
decimalType(String name, Double number)
Attribute that must be a decimalType value final MetadataBuilder
booleanType(String name, Boolean example)
Attribute that must be a boolean final MetadataBuilder
matchRegex(String name, String regex, String value)
Attribute that must match the regular expression final MetadataBuilder
datetime(String name)
Attribute that must be an ISO formatted datetime final MetadataBuilder
datetime(String name, String format)
Attribute that must match the given datetime format final MetadataBuilder
datetime(String name, String format, Date example)
Attribute that must match the given datetime format final MetadataBuilder
datetime(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the given datetime format final MetadataBuilder
datetime(String name, String format, Instant example)
Attribute that must match the given datetime format final MetadataBuilder
datetime(String name, String format, Instant example, TimeZone timeZone)
Attribute that must match the given datetime format final MetadataBuilder
date(String name)
Attribute that must be formatted as an ISO date final MetadataBuilder
date(String name, String format)
Attribute that must match the provided date format final MetadataBuilder
date(String name, String format, Date example)
Attribute that must match the provided date format final MetadataBuilder
date(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the provided date format final MetadataBuilder
time(String name)
Attribute that must be an ISO formatted time final MetadataBuilder
time(String name, String format)
Attribute that must match the given time format final MetadataBuilder
time(String name, String format, Date example)
Attribute that must match the given time format final MetadataBuilder
time(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the given time format final MetadataBuilder
ipAddress(String name)
Attribute that must be an IP4 address final MetadataBuilder
hexValue(String name)
Attribute that must be encoded as a hexadecimal value final MetadataBuilder
hexValue(String name, String hexValue)
Attribute that must be encoded as a hexadecimal value final MetadataBuilder
uuid(String name)
Attribute that must be encoded as an UUID final MetadataBuilder
uuid(String name, UUID uuid)
Attribute that must be encoded as an UUID final MetadataBuilder
uuid(String name, String uuid)
Attribute that must be encoded as an UUID final MetadataBuilder
includesStr(String name, String value)
Attribute that must include the provided string value final MetadataBuilder
matchUrl(String name, String basePath, Object pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions final MetadataBuilder
valueFromProviderState(String name, String expression, Object example)
Adds an attribute that will have it's value injected from the provider state final MetadataBuilder
dateExpression(String name, String expression)
Adds a date attribute formatted as an ISO date with the value generated by the date expression final MetadataBuilder
dateExpression(String name, String expression, String format)
Adds a date attribute with the value generated by the date expression final MetadataBuilder
timeExpression(String name, String expression)
Adds a time attribute formatted as an ISO time with the value generated by the time expression final MetadataBuilder
timeExpression(String name, String expression, String format)
Adds a time attribute with the value generated by the time expression final MetadataBuilder
datetimeExpression(String name, String expression)
Adds a datetime attribute formatted as an ISO datetime with the value generated by the expression final MetadataBuilder
datetimeExpression(String name, String expression, String format)
Adds a datetime attribute with the value generated by the expression -
-
Method Detail
-
getMatchers
final MatchingRuleCategory getMatchers()
-
getGenerators
final Map<String, Generator> getGenerators()
-
add
final MetadataBuilder add(String key, Object value)
Add an entry to the metadata
-
like
final MetadataBuilder like(String name, Object example)
Attribute that must be the same type as the example
- Parameters:
name
- attribute name
-
numberType
final MetadataBuilder numberType(String name, Number number)
Attribute that can be any number
- Parameters:
name
- attribute namenumber
- example number to use for generated messages
-
integerType
final MetadataBuilder integerType(String name, Long number)
Attribute that must be an integer
- Parameters:
name
- attribute namenumber
- example integer value to use for generated messages
-
integerType
final MetadataBuilder integerType(String name, Integer number)
Attribute that must be an integer
- Parameters:
name
- attribute namenumber
- example integer value to use for generated messages
-
decimalType
final MetadataBuilder decimalType(String name, BigDecimal number)
Attribute that must be a decimalType value
- Parameters:
name
- attribute namenumber
- example decimalType value
-
decimalType
final MetadataBuilder decimalType(String name, Double number)
Attribute that must be a decimalType value
- Parameters:
name
- attribute namenumber
- example decimalType value
-
booleanType
final MetadataBuilder booleanType(String name, Boolean example)
Attribute that must be a boolean
- Parameters:
name
- attribute nameexample
- example boolean to use for generated bodies
-
matchRegex
final MetadataBuilder matchRegex(String name, String regex, String value)
Attribute that must match the regular expression
- Parameters:
name
- attribute nameregex
- regular expressionvalue
- example value to use for generated bodies
-
datetime
final MetadataBuilder datetime(String name)
Attribute that must be an ISO formatted datetime
-
datetime
final MetadataBuilder datetime(String name, String format)
Attribute that must match the given datetime format
- Parameters:
name
- attribute nameformat
- datetime format
-
datetime
final MetadataBuilder datetime(String name, String format, Date example)
Attribute that must match the given datetime format
- Parameters:
name
- attribute nameformat
- datetime formatexample
- example date and time to use for generated bodies
-
datetime
final MetadataBuilder datetime(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the given datetime format
- Parameters:
name
- attribute nameformat
- datetime formatexample
- example date and time to use for generated bodiestimeZone
- time zone used for formatting of example date and time
-
datetime
final MetadataBuilder datetime(String name, String format, Instant example)
Attribute that must match the given datetime format
- Parameters:
name
- attribute nameformat
- datetime formatexample
- example date and time to use for generated bodies
-
datetime
final MetadataBuilder datetime(String name, String format, Instant example, TimeZone timeZone)
Attribute that must match the given datetime format
- Parameters:
name
- attribute nameformat
- timestamp formatexample
- example date and time to use for generated bodiestimeZone
- time zone used for formatting of example date and time
-
date
final MetadataBuilder date(String name)
Attribute that must be formatted as an ISO date
- Parameters:
name
- attribute name
-
date
final MetadataBuilder date(String name, String format)
Attribute that must match the provided date format
- Parameters:
name
- attribute dateformat
- date format to match
-
date
final MetadataBuilder date(String name, String format, Date example)
Attribute that must match the provided date format
- Parameters:
name
- attribute dateformat
- date format to matchexample
- example date to use for generated values
-
date
final MetadataBuilder date(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the provided date format
- Parameters:
name
- attribute dateformat
- date format to matchexample
- example date to use for generated valuestimeZone
- time zone used for formatting of example date
-
time
final MetadataBuilder time(String name)
Attribute that must be an ISO formatted time
- Parameters:
name
- attribute name
-
time
final MetadataBuilder time(String name, String format)
Attribute that must match the given time format
- Parameters:
name
- attribute nameformat
- time format to match
-
time
final MetadataBuilder time(String name, String format, Date example)
Attribute that must match the given time format
- Parameters:
name
- attribute nameformat
- time format to matchexample
- example time to use for generated bodies
-
time
final MetadataBuilder time(String name, String format, Date example, TimeZone timeZone)
Attribute that must match the given time format
- Parameters:
name
- attribute nameformat
- time format to matchexample
- example time to use for generated bodiestimeZone
- time zone used for formatting of example time
-
ipAddress
final MetadataBuilder ipAddress(String name)
Attribute that must be an IP4 address
- Parameters:
name
- attribute name
-
hexValue
final MetadataBuilder hexValue(String name)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name
- attribute name
-
hexValue
final MetadataBuilder hexValue(String name, String hexValue)
Attribute that must be encoded as a hexadecimal value
- Parameters:
name
- attribute namehexValue
- example value to use for generated bodies
-
uuid
final MetadataBuilder uuid(String name)
Attribute that must be encoded as an UUID
- Parameters:
name
- attribute name
-
uuid
final MetadataBuilder uuid(String name, UUID uuid)
Attribute that must be encoded as an UUID
- Parameters:
name
- attribute nameuuid
- example UUID to use for generated bodies
-
uuid
final MetadataBuilder uuid(String name, String uuid)
Attribute that must be encoded as an UUID
- Parameters:
name
- attribute nameuuid
- example UUID to use for generated bodies
-
includesStr
final MetadataBuilder includesStr(String name, String value)
Attribute that must include the provided string value
- Parameters:
name
- attribute namevalue
- Value that must be included
-
matchUrl
final MetadataBuilder matchUrl(String name, String basePath, Object pathFragments)
Matches a URL that is composed of a base path and a sequence of path expressions
- Parameters:
name
- Attribute namebasePath
- The base path for the URL (like "http://localhost:8080/") which will be excluded from the matchingpathFragments
- Series of path fragments to match on.
-
valueFromProviderState
final MetadataBuilder valueFromProviderState(String name, String expression, Object example)
Adds an attribute that will have it's value injected from the provider state
- Parameters:
name
- Attribute nameexpression
- Expression to be evaluated from the provider stateexample
- Example value to be used in the consumer test
-
dateExpression
final MetadataBuilder dateExpression(String name, String expression)
Adds a date attribute formatted as an ISO date with the value generated by the date expression
- Parameters:
name
- Attribute nameexpression
- Date expression to use to generate the values
-
dateExpression
final MetadataBuilder dateExpression(String name, String expression, String format)
Adds a date attribute with the value generated by the date expression
- Parameters:
name
- Attribute nameexpression
- Date expression to use to generate the valuesformat
- Date format to use
-
timeExpression
final MetadataBuilder timeExpression(String name, String expression)
Adds a time attribute formatted as an ISO time with the value generated by the time expression
- Parameters:
name
- Attribute nameexpression
- Time expression to use to generate the values
-
timeExpression
final MetadataBuilder timeExpression(String name, String expression, String format)
Adds a time attribute with the value generated by the time expression
- Parameters:
name
- Attribute nameexpression
- Time expression to use to generate the valuesformat
- Time format to use
-
datetimeExpression
final MetadataBuilder datetimeExpression(String name, String expression)
Adds a datetime attribute formatted as an ISO datetime with the value generated by the expression
- Parameters:
name
- Attribute nameexpression
- Datetime expression to use to generate the values
-
datetimeExpression
final MetadataBuilder datetimeExpression(String name, String expression, String format)
Adds a datetime attribute with the value generated by the expression
- Parameters:
name
- Attribute nameexpression
- Datetime expression to use to generate the valuesformat
- Datetime format to use
-
-
-
-