### 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 : FAILURE; } private  RemoteService();   RemoteService(RandomProvider randomProvider); @Override long doRemoteFunction(int value);  }### Answer:
@Test public void testFailedCall() { RemoteService remoteService = new RemoteService( new StaticRandomProvider(0.21)); long result = remoteService.doRemoteFunction(10); assertEquals(RemoteServiceInterface.FAILURE, result); }
@Test public void testSuccessfulCall() { RemoteService remoteService = new RemoteService( new StaticRandomProvider(0.2)); long result = remoteService.doRemoteFunction(10); assertEquals(100, result); }