org.junit.jupiter.params.aggregator.ArgumentsAggregationException Java Examples

The following examples show how to use org.junit.jupiter.params.aggregator.ArgumentsAggregationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteActionCodeTest.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Method aggregateArguments(
    final ArgumentsAccessor arguments, final ParameterContext context)
    throws ArgumentsAggregationException {
  // Ignore CSV columns that are already used by different parameters
  final int offset = context.getIndex();
  final Class<?> remoteInterface = arguments.get(offset, Class.class);
  final String methodName = arguments.getString(offset + 1);
  final Class<?>[] argumentTypes =
      IntStream.range(offset + 2, arguments.size())
          .mapToObj(i -> arguments.get(i, Class.class))
          .toArray(Class<?>[]::new);
  try {
    return remoteInterface.getMethod(methodName, argumentTypes);
  } catch (final NoSuchMethodException e) {
    throw new ArgumentsAggregationException("Invalid method specified", e);
  }
}
 
Example #2
Source File: ArgumentAggregatorTest.java    From demo-junit-5 with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public Object aggregateArguments(
		ArgumentsAccessor arguments, ParameterContext context) throws ArgumentsAggregationException {
	return Point.from(arguments.getDouble(1), arguments.getDouble(2));
}
 
Example #3
Source File: PersonAggregator.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context)
        throws ArgumentsAggregationException {
    return new Person(accessor.getString(1), accessor.getString(2), accessor.getString(3));
}