CalvalusWpsProvider implements WpsServiceInstance { @Override public void dispose() { Timer statusObserver = CalvalusProductionService.getStatusObserverSingleton(); statusObserver.cancel(); System.out.println("********************************************"); System.out.println("****** Stopping Calvalus WPS intance ******"); System.out.println("********************************************"); }  @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 canDispose() throws Exception { PowerMockito.mockStatic(PropertiesWrapper.class); PowerMockito.mockStatic(CalvalusProductionService.class); Timer mockTimer = mock(Timer.class); PowerMockito.when(CalvalusProductionService.getStatusObserverSingleton()).thenReturn(mockTimer); calvalusProvider.dispose(); verify(mockTimer, times(1)).cancel(); }