### Question:
SecHubExecutionException extends Exception { public static void throwAsSecHubExecutionException(String message, Exception e) throws SecHubExecutionException { if (e instanceof SecHubExecutionException) { throw (SecHubExecutionException) e; } else { throw new SecHubExecutionException(message, e); } } SecHubExecutionException(String message, Throwable cause);  SecHubExecutionException(String message); static void throwAsSecHubExecutionException(String message, Exception e);  }### Answer:
@Test public void throwAsSecHubExecutionException_throws_adapter_exception_when_exception_is_runtime_exception() throws Exception { RuntimeException cause = new RuntimeException(); expected.expect(SecHubExecutionException.class); expected.expectMessage("message1"); expected.expectCause(equalTo(cause)); throwAsSecHubExecutionException("message1", cause); }
@Test public void throwAsSecHubExecutionException_rethrows_adapter_exception_when_exception_is_adapter_exception() throws Exception { SecHubExecutionException cause = new SecHubExecutionException("originMessage"); expected.expect(SecHubExecutionException.class); expected.expectMessage("originMessage"); throwAsSecHubExecutionException("otherMessage", cause); }