@Test public void testRegisterWhenMarshallingErrors() throws Exception { prepareTargetPath(); expectedException.expectMessage("Unexpected error was produced during trace marshalling/storing, trace: " + trace); doThrow(new Exception("no matter the message here")) .when(registryHelper) .storeEntry(traceTargetPath, trace); pipelineExecutorRegistry.register(trace); }
@Test public void testRegisterWhenMarshallingErrors() throws Exception { prepareTargetPath(); expectedException.expectMessage("Unexpected error was produced during trace marshalling/storing, trace: " + trace); doThrow(new Exception("no matter the message here")) .when(registryHelper) .storeEntry(traceTargetPath, trace); pipelineExecutorRegistry.register(trace); }
@Test @Override public void testRegister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); try { verify(registryHelper, times(1)).storeEntry(traceTargetPath, trace); } catch (Exception e) { //need to catch this exception because parent class method don't throws exceptions, //but this will never happen in this scenario. fail(e.getMessage()); } PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test @Override public void testRegister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); try { verify(registryHelper, times(1)).storeEntry(traceTargetPath, trace); } catch (Exception e) { //need to catch this exception because parent class method don't throws exceptions, //but this will never happen in this scenario. fail(e.getMessage()); } PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test @Override public void testDeregister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(PIPELINE_EXECUTION_ID); verify(registryHelper, times(1)).deleteBatch(traceTargetPath); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }
@Test @Override public void testDeregister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(PIPELINE_EXECUTION_ID); verify(registryHelper, times(1)).deleteBatch(traceTargetPath); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }