use of com.github.robozonky.api.remote.entities.Participation in project robozonky by RoboZonky.
the class ParticipationDescriptorTest method recommend.
@Test
void recommend() {
final Participation p = ParticipationDescriptorTest.mockParticipation(BigDecimal.TEN);
final ParticipationDescriptor pd = new ParticipationDescriptor(p);
final Optional<RecommendedParticipation> r = pd.recommend(p.getRemainingPrincipal());
assertThat(r).isPresent();
assertSoftly(softly -> {
softly.assertThat(r.get().amount()).isEqualTo(p.getRemainingPrincipal());
softly.assertThat(r.get().descriptor()).isEqualTo(pd);
});
}
use of com.github.robozonky.api.remote.entities.Participation in project robozonky by RoboZonky.
the class ParticipationDescriptorTest method mockParticipation.
private static Participation mockParticipation(final BigDecimal amount) {
final Participation p = mock(Participation.class);
when(p.getRemainingPrincipal()).thenReturn(amount);
return p;
}
use of com.github.robozonky.api.remote.entities.Participation in project robozonky by RoboZonky.
the class ParticipationDescriptorTest method recommendWrong.
@Test
void recommendWrong() {
final Participation p = ParticipationDescriptorTest.mockParticipation(BigDecimal.TEN);
final ParticipationDescriptor pd = new ParticipationDescriptor(p);
final Optional<RecommendedParticipation> r = pd.recommend(p.getRemainingPrincipal().subtract(BigDecimal.ONE));
assertThat(r).isEmpty();
}
use of com.github.robozonky.api.remote.entities.Participation in project robozonky by RoboZonky.
the class RecommendedParticipationTest method mockParticipation.
private static Participation mockParticipation() {
final Participation p = mock(Participation.class);
when(p.getRemainingPrincipal()).thenReturn(BigDecimal.TEN);
return p;
}
use of com.github.robozonky.api.remote.entities.Participation in project robozonky by RoboZonky.
the class ZonkyTest method wallet.
@Test
void wallet() {
final ControlApi control = mock(ControlApi.class);
final Api<ControlApi> ca = mockApi(control);
final PaginatedApi<RawLoan, LoanApi> la = mockApi();
final PaginatedApi<BlockedAmount, WalletApi> wa = mockApi();
when(wa.execute((Function<WalletApi, Wallet>) any())).thenReturn(mock(Wallet.class));
final PaginatedApi<RawInvestment, PortfolioApi> pa = mockApi();
final PaginatedApi<Participation, ParticipationApi> sa = mockApi();
final PaginatedApi<RawDevelopment, CollectionsApi> caa = mockApi();
final Zonky z = new Zonky(ca, la, sa, pa, wa, caa);
final Wallet w = z.getWallet();
assertThat(w).isNotNull();
}
Aggregations