Add test for passing @MatrixVariable without specified name. Add documentation for @MatrixVariable support. Fixes gh-307.
This commit is contained in:
@@ -554,6 +554,22 @@ public class SpringMvcContractTests {
|
||||
.isEqualTo(data.indexToExpander().get(0).expand("value"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatrixVariableWithNoName() throws NoSuchMethodException {
|
||||
Method method = TestTemplate_MatrixVariable.class
|
||||
.getDeclaredMethod("matrixVariableNotNamed", Map.class);
|
||||
MethodMetadata data = this.contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
Map<String, String> testMap = new HashMap<>();
|
||||
|
||||
testMap.put("param", "value");
|
||||
|
||||
assertThat(data.template().method()).isEqualTo("GET");
|
||||
assertThat(data.template().url()).isEqualTo("/matrixVariable/{params}");
|
||||
assertThat(";param=value")
|
||||
.isEqualTo(data.indexToExpander().get(0).expand(testMap));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddingTemplatedParameterWithTheSameKey()
|
||||
throws NoSuchMethodException {
|
||||
@@ -697,6 +713,9 @@ public class SpringMvcContractTests {
|
||||
@RequestMapping(path = "/matrixVariableObject/{param}")
|
||||
String matrixVariableObject(@MatrixVariable("param") Object object);
|
||||
|
||||
@RequestMapping(path = "/matrixVariable/{params}")
|
||||
String matrixVariableNotNamed(@MatrixVariable Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
@JsonAutoDetect
|
||||
|
||||
Reference in New Issue
Block a user