@Test public void testExceptionHandlerOwnerAndMsgNull() { Exception res = null; try { ActionExceptionHandler.handleError(new TestConfiguration(), null, null); } catch (ActionException e) { res = e; assertEquals("An error occurred. No details are avaiable.", res.getMessage()); } assertTrue(res instanceof ActionException); }
@Test public void testExceptionHandlerWithFailIgnored() { Exception res = null; TestConfiguration testConf = new TestConfiguration(); testConf.setFailIgnored(true); try { ActionExceptionHandler.handleError(testConf, new TestAction(), "an error message."); } catch (ActionException e) { fail(); } assertTrue(res == null); }
/** * This test check when a null configuration is provided. must throw an IllegalArgumentException */ @Test public void testExceptionHandlerConfigNull() { Exception res = null; try { ActionExceptionHandler.handleError(null, new TestAction(), "a message"); } catch (IllegalArgumentException e) { return; } catch (Exception e) { fail(); } fail(); }
@Test public void testExceptionHandler() { Exception res = null; try { ActionExceptionHandler.handleError( new TestConfiguration(), new TestAction(), "an error message."); } catch (ActionException e) { res = e; assertEquals("an error message.", res.getMessage()); } assertTrue(res instanceof ActionException); }