FailAction extends AbstractTestAction { public String getMessage() { return message; } FailAction(Builder builder); @Override void doExecute(TestContext context); String getMessage();  }
@Test public void testFailStandardMessage() { FailAction fail = new FailAction.Builder().build(); try { fail.execute(context); } catch(CitrusRuntimeException e) { Assert.assertEquals("Generated error to interrupt test execution", e.getMessage()); return; } Assert.fail("Missing CitrusRuntimeException"); }
@Test public void testFailCustomizedMessage() { FailAction fail = new FailAction.Builder() .message("Failed because I said so") .build(); try { fail.execute(context); } catch(CitrusRuntimeException e) { Assert.assertEquals("Failed because I said so", e.getMessage()); return; } Assert.fail("Missing CitrusRuntimeException"); }
@Test public void testFailCustomizedMessageWithVariables() { FailAction fail = new FailAction.Builder() .message("Failed because I said so, ${text}") .build(); context.setVariable("text", "period!"); try { fail.execute(context); } catch(CitrusRuntimeException e) { Assert.assertEquals("Failed because I said so, period!", e.getMessage()); return; } Assert.fail("Missing CitrusRuntimeException"); }