CalvalusWpsProvider implements WpsServiceInstance { @Override public List<ProcessDescriptionType> describeProcess(WpsRequestContext wpsRequestContext, String processId) throws WpsServiceException { try { CalvalusDescribeProcessOperation describeProcessOperation = new CalvalusDescribeProcessOperation(wpsRequestContext); return describeProcessOperation.getProcesses(processId); } catch (WpsProcessorNotFoundException | IOException exception) { logger.log(Level.SEVERE, "Unable to perform DescribeProcess 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 canDescribeProcess() throws Exception { CalvalusDescribeProcessOperation mockDescribeProcess = mock(CalvalusDescribeProcessOperation.class); PowerMockito.whenNew(CalvalusDescribeProcessOperation.class).withArguments(mockRequestContext).thenReturn(mockDescribeProcess); ArgumentCaptor<String> jobId = ArgumentCaptor.forClass(String.class); calvalusProvider.describeProcess(mockRequestContext, DUMMY_ID); verify(mockDescribeProcess, times(1)).getProcesses(jobId.capture()); assertThat(jobId.getValue(), equalTo("dummyId")); }
@Test(expected = WpsServiceException.class) public void canThrowExceptionDescribeProcess() throws Exception { CalvalusDescribeProcessOperation mockDescribeProcess = mock(CalvalusDescribeProcessOperation.class); when(mockDescribeProcess.getProcesses(DUMMY_ID)).thenThrow(new WpsProcessorNotFoundException("process not available")); PowerMockito.whenNew(CalvalusDescribeProcessOperation.class).withArguments(mockRequestContext).thenReturn(mockDescribeProcess); calvalusProvider.describeProcess(mockRequestContext, DUMMY_ID); }