### Question:
PendingResultHandler { public Object pollValue(final String pendingResultId) throws Exception { final PendingResult pendingResult = pendingResultsHolder.get(pendingResultId); return pendingResult.pollResult().getValue(); } @Autowired  PendingResultHandler(final PendingResultsHolder pendingResultsHolder,
            @Value("${server.application.name}") final String applicationName); String createPendingResult(); void removePendingResult(final String pendingResultId); Object pollValue(final String pendingResultId); void offerValue(final String pendingResultId, final Object value); void offerException(final String pendingResultId, final Exception exception);  }### Answer:
@Test public void shouldPollValue_withPendingResultId() throws Exception { final Object value = new Object(); final Result result = mock(Result.class); when(result.getValue()).thenReturn(value); final PendingResult mockPendingResult = mock(PendingResult.class); when(mockPendingResult.pollResult()).thenReturn(result); final String pendingResultId = randomId(); when(mockPendingResultsHolder.get(pendingResultId)).thenReturn(mockPendingResult); final Object returnedValue = pendingResultHandler.pollValue(pendingResultId); assertNotNull(returnedValue); assertSame(value, returnedValue); }