DefaultErrorBundle implements ErrorBundle { @Override public String getErrorMessage() { return (exception == null) ? DEFAULT_ERROR_MSG : this.exception.getMessage(); } DefaultErrorBundle(Throwable exception); @Override Throwable getException(); @Override String getErrorMessage();  }
@Test public void testGetErrorMessageInteraction() { String message = "a message"; when(mockException.getMessage()).thenReturn(message); String result = defaultErrorBundle.getErrorMessage(); Assert.assertEquals(message, result); verify(mockException).getMessage(); }