### Question:
RemoteService implements RemoteServiceInterface { @Override public long doRemoteFunction(int value) { long waitTime = (long) Math.floor(randomProvider.random() * 1000); try { sleep(waitTime); } catch (InterruptedException e) { LOGGER.error("Thread sleep state interrupted", e); } return waitTime <= THRESHOLD ? value * 10 : RemoteServiceStatus.FAILURE.getRemoteServiceStatusValue(); } private  RemoteService();   RemoteService(RandomProvider randomProvider); @Override long doRemoteFunction(int value);  }### Answer:
@Test void testFailedCall() { var remoteService = new RemoteService(new StaticRandomProvider(0.21)); var result = remoteService.doRemoteFunction(10); assertEquals(RemoteServiceStatus.FAILURE.getRemoteServiceStatusValue(), result); }
@Test void testSuccessfulCall() { var remoteService = new RemoteService(new StaticRandomProvider(0.2)); var result = remoteService.doRemoteFunction(10); assertEquals(100, result); }