CalvalusWpsProvider implements WpsServiceInstance { @Override public ExecuteResponse getStatus(WpsRequestContext wpsRequestContext, String jobId) throws WpsServiceException { try { CalvalusGetStatusOperation getStatusOperation = new CalvalusGetStatusOperation(wpsRequestContext); return getStatusOperation.getStatus(jobId); } catch (IOException | InvalidProcessorIdException | SqlStoreException exception) { logger.log(Level.SEVERE, "Unable to perform GetStatus operation successfully", exception); throw new WpsServiceException(exception); } }  @Override Capabilities getCapabilities(WpsRequestContext wpsRequestContext); @Override List<ProcessDescriptionType> describeProcess(WpsRequestContext wpsRequestContext, String processId); @Override ExecuteResponse doExecute(WpsRequestContext wpsRequestContext, Execute executeRequest); @Override ExecuteResponse getStatus(WpsRequestContext wpsRequestContext, String jobId); @Override void dispose();  }
@Test public void canGetStatus() throws Exception { CalvalusGetStatusOperation mockGetStatus = mock(CalvalusGetStatusOperation.class); PowerMockito.whenNew(CalvalusGetStatusOperation.class).withArguments(mockRequestContext).thenReturn(mockGetStatus); ArgumentCaptor<String> jobId = ArgumentCaptor.forClass(String.class); calvalusProvider.getStatus(mockRequestContext, DUMMY_ID); verify(mockGetStatus, times(1)).getStatus(jobId.capture()); assertThat(jobId.getValue(), equalTo("dummyId")); }
@Test(expected = WpsServiceException.class) public void canCatchIOExceptionWhenCreatingGetStatus() throws Exception { PowerMockito.whenNew(CalvalusGetStatusOperation.class).withArguments(mockRequestContext).thenThrow(new IOException()); calvalusProvider.getStatus(mockRequestContext, DUMMY_ID); }