@Test public void testRegisterRuntimeWhenMarshallingErrors() throws Exception { prepareRuntimeTargetPath(); expectedException.expectMessage("Unexpected error was produced during runtime marshalling/storing, runtime: " + runtime); doThrow(new Exception("no matter the message here")) .when(registryHelper) .storeEntry(runtimeTargetPath, runtime); runtimeRegistry.registerRuntime(runtime); }
@Test public void testRegisterRuntimeWhenMarshallingErrors() throws Exception { prepareRuntimeTargetPath(); expectedException.expectMessage("Unexpected error was produced during runtime marshalling/storing, runtime: " + runtime); doThrow(new Exception("no matter the message here")) .when(registryHelper) .storeEntry(runtimeTargetPath, runtime); runtimeRegistry.registerRuntime(runtime); }
@Test @Override public void testRegisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); try { verify(registryHelper, times(1)).storeEntry(runtimeTargetPath, runtime); } 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()); } verifyRuntimeIsRegistered(runtime); }
@Test @Override public void testRegisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); try { verify(registryHelper, times(1)).storeEntry(runtimeTargetPath, runtime); } 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()); } verifyRuntimeIsRegistered(runtime); }
@Test @Override public void testDeregisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); verifyRuntimeIsRegistered(runtime); runtimeRegistry.deregisterRuntime(runtime); verify(registryHelper, times(1)).deleteBatch(runtimeTargetPath); verifyRuntimeIsNotRegistered(runtime); }
@Test @Override public void testDeregisterRuntime() { prepareRuntimeTargetPath(); runtimeRegistry.registerRuntime(runtime); verifyRuntimeIsRegistered(runtime); runtimeRegistry.deregisterRuntime(runtime); verify(registryHelper, times(1)).deleteBatch(runtimeTargetPath); verifyRuntimeIsNotRegistered(runtime); }