public class RestDocumentationContextPlaceholderResolver extends Object implements org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver
PropertyPlaceholderHelper.PlaceholderResolver
that resolves placeholders using a
RestDocumentationContext
. The following placeholders are supported:
step
- the step current
count
.
methodName
- the unmodified name of the
current test method
without
applying any formatting
method-name
- the name of the
current test method
formatted
using kebab-case
method_name
- the name of the
current test method
formatted
using snake_case
ClassName
- the unmodified simple name
of the
current test class
class-name
- the simple name
of the
current test class
formatted using
kebab-case
class_name
- the simple name
of the
current test class
formatted using
snake case
Constructor and Description |
---|
RestDocumentationContextPlaceholderResolver(RestDocumentationContext context)
Creates a new placeholder resolver that will resolve placeholders using the given
context . |
Modifier and Type | Method and Description |
---|---|
protected String |
camelCaseToKebabCase(String string)
Converts the given
string from camelCase to kebab-case. |
protected String |
camelCaseToSnakeCase(String string)
Converts the given
string from camelCase to snake_case. |
protected RestDocumentationContext |
getContext()
Returns the
RestDocumentationContext that should be used during placeholder
resolution. |
String |
resolvePlaceholder(String placeholderName) |
public RestDocumentationContextPlaceholderResolver(RestDocumentationContext context)
context
.context
- the context to usepublic String resolvePlaceholder(String placeholderName)
resolvePlaceholder
in interface org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver
protected final String camelCaseToKebabCase(String string)
string
from camelCase to kebab-case.string
- the stringprotected final String camelCaseToSnakeCase(String string)
string
from camelCase to snake_case.string
- the stringprotected final RestDocumentationContext getContext()
RestDocumentationContext
that should be used during placeholder
resolution.