Class RestDocumentationContextPlaceholderResolver
java.lang.Object
org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolver
- All Implemented Interfaces:
org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver
public class RestDocumentationContextPlaceholderResolver
extends Object
implements org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver
A
PropertyPlaceholderHelper.PlaceholderResolver
that resolves placeholders using a
RestDocumentationContext
. The following placeholders are supported:
step
- thestep current count
.methodName
- the unmodified name of thecurrent test method
without applying any formattingmethod-name
- the name of thecurrent test method
formatted using kebab-casemethod_name
- the name of thecurrent test method
formatted using snake_caseClassName
- the unmodifiedsimple name
of thecurrent test class
class-name
- thesimple name
of thecurrent test class
formatted using kebab-caseclass_name
- thesimple name
of thecurrent test class
formatted using snake case
- Author:
- Andy Wilkinson
-
Constructor Summary
ConstructorDescriptionCreates a new placeholder resolver that will resolve placeholders using the givencontext
. -
Method Summary
Modifier and TypeMethodDescriptionprotected final String
camelCaseToKebabCase
(String string) Converts the givenstring
from camelCase to kebab-case.protected final String
camelCaseToSnakeCase
(String string) Converts the givenstring
from camelCase to snake_case.protected final RestDocumentationContext
Returns theRestDocumentationContext
that should be used during placeholder resolution.resolvePlaceholder
(String placeholderName)
-
Constructor Details
-
RestDocumentationContextPlaceholderResolver
Creates a new placeholder resolver that will resolve placeholders using the givencontext
.- Parameters:
context
- the context to use
-
-
Method Details
-
resolvePlaceholder
- Specified by:
resolvePlaceholder
in interfaceorg.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver
-
camelCaseToKebabCase
Converts the givenstring
from camelCase to kebab-case.- Parameters:
string
- the string- Returns:
- the converted string
-
camelCaseToSnakeCase
Converts the givenstring
from camelCase to snake_case.- Parameters:
string
- the string- Returns:
- the converted string
-
getContext
Returns theRestDocumentationContext
that should be used during placeholder resolution.- Returns:
- the context
-