use of com.github.robozonky.api.confirmations.ConfirmationProvider in project robozonky by RoboZonky.
the class InvestorTest method getZonkyProxy.
private Investor getZonkyProxy(final ProxyType proxyType, final RemoteResponse confirmationResponse, final Authenticated auth) {
switch(proxyType) {
case SIMPLE:
return new Investor.Builder().build(auth);
case CONFIRMING:
final ConfirmationProvider cp = mock(ConfirmationProvider.class);
when(cp.getId()).thenReturn("something");
switch(confirmationResponse) {
case ACK:
when(cp.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(true);
break;
case NAK:
when(cp.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(false);
break;
default:
throw new IllegalStateException();
}
return new Investor.Builder().usingConfirmation(cp).build(auth);
default:
throw new IllegalStateException();
}
}
use of com.github.robozonky.api.confirmations.ConfirmationProvider in project robozonky by RoboZonky.
the class CheckerTest method confirmationsProper.
@Test
void confirmationsProper() {
final ConfirmationProvider cp = mock(ConfirmationProvider.class);
when(cp.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(false);
final boolean result = Checker.confirmations(cp, "", SECRET, CheckerTest::mockApiThatReturnsOneLoan);
assertThat(result).isFalse();
}
use of com.github.robozonky.api.confirmations.ConfirmationProvider in project robozonky by RoboZonky.
the class ConfirmationProviderLoaderTest method loading.
@Test
void loading() {
final String id = UUID.randomUUID().toString();
final ConfirmationProvider cp = new ConfirmationProvider() {
@Override
public boolean requestConfirmation(final RequestId auth, final int loanId, final int amount) {
return false;
}
@Override
public String getId() {
return id;
}
};
final ConfirmationProviderService cps = strategy -> Optional.of(cp);
assertThat(ConfirmationProviderLoader.load(id, Collections.singleton(cps))).contains(cp);
}
Aggregations