use of com.github.robozonky.api.remote.entities.MyInvestment in project robozonky by RoboZonky.
the class AbstractZonkyLeveragingTest method mockMyInvestment.
protected static MyInvestment mockMyInvestment(final OffsetDateTime creationDate) {
final MyInvestment m = mock(MyInvestment.class);
when(m.getTimeCreated()).thenReturn(creationDate);
return m;
}
use of com.github.robozonky.api.remote.entities.MyInvestment in project robozonky by RoboZonky.
the class LoanCacheTest method emptyGetLoan.
@Test
void emptyGetLoan() {
final LoanCache c = new LoanCache();
final int loanId = 1;
// nothing returned at first
assertThat(c.getLoan(loanId)).isEmpty();
final MyInvestment mi = mock(MyInvestment.class);
when(mi.getTimeCreated()).thenReturn(OffsetDateTime.now());
final Loan loan = Loan.custom().setId(loanId).setMyInvestment(mi).build();
final Zonky z = harmlessZonky(10_000);
when(z.getLoan(eq(loanId))).thenReturn(loan);
// return the freshly retrieved loan
assertThat(c.getLoan(loanId, z)).isEqualTo(loan);
final Investment i = Investment.custom().setLoanId(loanId).build();
assertThat(c.getLoan(i, z)).isEqualTo(loan);
assertThat(i.getInvestmentDate()).isNotEmpty();
}
use of com.github.robozonky.api.remote.entities.MyInvestment in project robozonky by RoboZonky.
the class FinancialCalculatorTest method mockLoan.
private static Loan mockLoan(final Rating rating) {
final MyInvestment investment = Mockito.mock(MyInvestment.class);
Mockito.when(investment.getTimeCreated()).thenReturn(OffsetDateTime.now());
return Loan.custom().setId(1).setAmount(100_000).setMyInvestment(investment).setRating(rating).setTermInMonths(84).build();
}
Aggregations