Skip to content

Commit

Permalink
HV-371: Adding MethodMetaData#getAllParameterMetaData()
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarmorling committed Mar 4, 2011
1 parent c257c4e commit 2d223ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Expand Up @@ -105,6 +105,18 @@ public ParameterMetaData getParameterMetaData(int parameterIndex) {
return parameterMetaData.get( parameterIndex );
}

/**
* Returns meta data for all parameters of the represented method.
*
* @return A list with parameter meta data. The length corresponds to the
* number of parameters of the method represented by this meta data
* object, so an empty list may be returned (in case of a
* parameterless method), but never <code>null</code>.
*/
public List<ParameterMetaData> getAllParameterMetaData() {
return parameterMetaData;
}

/**
* An iterator with the return value constraints of the represented method.
*/
Expand Down
Expand Up @@ -60,6 +60,7 @@ public void methodWithConstrainedParameter() throws Exception {
assertFalse( methodMetaData.isCascading() );
assertTrue( methodMetaData.isConstrained() );
assertIterableSize( methodMetaData, 0 );
assertEquals( methodMetaData.getAllParameterMetaData().size(), 2 );
}

@Test
Expand All @@ -72,6 +73,7 @@ public void methodWithCascadedParameter() throws Exception {
assertFalse( methodMetaData.isCascading() );
assertTrue( methodMetaData.isConstrained() );
assertIterableSize( methodMetaData, 0 );
assertEquals( methodMetaData.getAllParameterMetaData().size(), 1 );
}

@Test
Expand All @@ -87,6 +89,7 @@ public void methodWithConstrainedReturnValue() throws Exception {
assertEquals(
methodMetaData.iterator().next().getDescriptor().getAnnotation().annotationType(), NotNull.class
);
assertEquals( methodMetaData.getAllParameterMetaData().size(), 0 );
}

@Test
Expand All @@ -99,6 +102,7 @@ public void methodWithCascadedReturnValue() throws Exception {
assertTrue( methodMetaData.isCascading() );
assertTrue( methodMetaData.isConstrained() );
assertIterableSize( methodMetaData, 0 );
assertEquals( methodMetaData.getAllParameterMetaData().size(), 0 );
}

@Test
Expand All @@ -111,6 +115,7 @@ public void unconstrainedMethod() throws Exception {
assertFalse( methodMetaData.isCascading() );
assertFalse( methodMetaData.isConstrained() );
assertIterableSize( methodMetaData, 0 );
assertEquals( methodMetaData.getAllParameterMetaData().size(), 1 );
}

}

0 comments on commit 2d223ff

Please sign in to comment.