use of org.junit.jupiter.api.DynamicTest in project junit5 by junit-team.
the class ReflectionSupportTests method findAllClassesInClasspathRootDelegates.
@TestFactory
List<DynamicTest> findAllClassesInClasspathRootDelegates() throws Throwable {
List<DynamicTest> tests = new ArrayList<>();
List<Path> paths = new ArrayList<>();
paths.add(Paths.get(".").toRealPath());
paths.addAll(ReflectionUtils.getAllClasspathRootDirectories());
for (Path path : paths) {
URI root = path.toUri();
String displayName = root.getPath();
if (displayName.length() > 42) {
displayName = "..." + displayName.substring(displayName.length() - 42);
}
tests.add(DynamicTest.dynamicTest(displayName, () -> assertEquals(ReflectionUtils.findAllClassesInClasspathRoot(root, allTypes, allNames), ReflectionSupport.findAllClassesInClasspathRoot(root, allTypes, allNames))));
}
return tests;
}
use of org.junit.jupiter.api.DynamicTest in project robozonky by RoboZonky.
the class JmxListenerServiceTest method getParametersForInvestmentRejected.
private DynamicTest getParametersForInvestmentRejected() {
final Loan l = mockLoan();
final LoanDescriptor ld = new LoanDescriptor(l);
final RecommendedLoan r = ld.recommend(200).get();
final Event evt = new InvestmentRejectedEvent(r, "");
final Consumer<SoftAssertions> before = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getRejectedInvestments()).isEmpty();
};
final Consumer<SoftAssertions> after = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getRejectedInvestments()).containsOnlyKeys(l.getId());
softly.assertThat(mbean.getLatestUpdatedDateTime()).isEqualTo(evt.getCreatedOn());
};
return getParameters(evt, before, after);
}
use of org.junit.jupiter.api.DynamicTest in project robozonky by RoboZonky.
the class JmxListenerServiceTest method getParametersForSaleOffered.
private DynamicTest getParametersForSaleOffered() {
final Loan l = mockLoan();
final Investment i = Investment.fresh((MarketplaceLoan) l, 200);
final Event evt = new SaleOfferedEvent(i, l);
final Consumer<SoftAssertions> before = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getOfferedInvestments()).isEmpty();
};
final Consumer<SoftAssertions> after = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getOfferedInvestments()).containsOnlyKeys(i.getLoanId());
softly.assertThat(mbean.getLatestUpdatedDateTime()).isEqualTo(evt.getCreatedOn());
};
return getParameters(evt, before, after);
}
use of org.junit.jupiter.api.DynamicTest in project robozonky by RoboZonky.
the class JmxListenerServiceTest method getParametersForExecutionCompleted.
private DynamicTest getParametersForExecutionCompleted() {
final ExecutionCompletedEvent evt = new ExecutionCompletedEvent(Collections.emptyList(), null);
final Consumer<SoftAssertions> before = (softly) -> {
softly.assertThat(getRuntimeMBean().getZonkyUsername()).isEqualTo("");
};
final Consumer<SoftAssertions> after = (softly) -> {
softly.assertThat(getRuntimeMBean().getZonkyUsername()).isEqualTo(USERNAME);
softly.assertThat(getRuntimeMBean().getLatestUpdatedDateTime()).isEqualTo(evt.getCreatedOn());
softly.assertThat(getPortfolioMBean().getLatestUpdatedDateTime()).isEqualTo(evt.getCreatedOn());
};
return getParameters(evt, before, after);
}
use of org.junit.jupiter.api.DynamicTest in project robozonky by RoboZonky.
the class JmxListenerServiceTest method getParametersForInvestmentDelegated.
private DynamicTest getParametersForInvestmentDelegated() {
final Loan l = mockLoan();
final LoanDescriptor ld = new LoanDescriptor(l);
final RecommendedLoan r = ld.recommend(200).get();
final Event evt = new InvestmentDelegatedEvent(r, "");
final Consumer<SoftAssertions> before = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getDelegatedInvestments()).isEmpty();
};
final Consumer<SoftAssertions> after = (softly) -> {
final OperationsMBean mbean = getOperationsMBean();
softly.assertThat(mbean.getDelegatedInvestments()).containsOnlyKeys(l.getId());
softly.assertThat(mbean.getLatestUpdatedDateTime()).isEqualTo(evt.getCreatedOn());
};
return getParameters(evt, before, after);
}
Aggregations