下面列出了怎么用org.junit.jupiter.params.aggregator.AggregateWith的API类实例代码及写法,或者点击链接到github查看源代码。
@ParameterizedTest
@CsvFileSource(resources = "/required-op-codes.csv")
void verifyCorrectOpCode(
final int opCode, @AggregateWith(MethodAggregator.class) final Method method) {
final RemoteActionCode remoteActionCode = method.getAnnotation(RemoteActionCode.class);
assertThat(
"Expected @RemoteActionCode annotation to be present for " + method,
remoteActionCode,
is(notNullValue()));
assertThat("Invalid value for " + method, remoteActionCode.value(), is(opCode));
}
@ParameterizedTest
@CsvSource({"Isaac Newton,Isaac,,Newton", "Charles Robert Darwin,Charles,Robert,Darwin"})
void fullName_ShouldGenerateTheExpectedFullName(String expectedFullName,
@AggregateWith(PersonAggregator.class) Person person) {
assertEquals(expectedFullName, person.fullName());
}