use of com.github.robozonky.app.portfolio.PortfolioDependant in project robozonky by RoboZonky.
the class BlockedAmountsUpdaterTest method customDependant.
@Test
void customDependant() {
final Portfolio p = mock(Portfolio.class);
final PortfolioDependant d = mock(PortfolioDependant.class);
final Authenticated auth = mock(Authenticated.class);
final BlockedAmountsUpdater bau = new BlockedAmountsUpdater(auth, () -> Optional.of(p), d);
bau.run();
verify(d).accept(eq(p), eq(auth));
}
use of com.github.robozonky.app.portfolio.PortfolioDependant in project robozonky by RoboZonky.
the class PortfolioUpdaterTest method updatingDependants.
@Test
void updatingDependants() {
final Zonky z = harmlessZonky(10_000);
final Authenticated a = mockAuthentication(z);
final PortfolioDependant dependant = mock(PortfolioDependant.class);
final PortfolioUpdater instance = new PortfolioUpdater((t) -> {
}, a, mockBalance(z));
instance.registerDependant(dependant);
instance.run();
// this is the call to update Portfolio
verify(a, times(2)).call(any());
final Optional<Portfolio> result = instance.get();
// make sure that the dependants were called with the proper value of Portfolio
verify(dependant).accept(eq(result.get()), eq(a));
// it's false when update finished
assertThat(instance.isUpdating()).isFalse();
}
Aggregations