@Test public void shouldNotReturnExceptionToClientIfExpectedRulePassing() throws Exception { State.caughtTestException(new IllegalArgumentException()); JUnitTestRunner runner = new JUnitTestRunner(); TestResult result = runner.execute(TestScenarios.class, "shouldPassOnException"); Assert.assertEquals(TestResult.Status.PASSED, result.getStatus()); Assert.assertNull(result.getThrowable()); }
static boolean isClassPresent(String name) { try { loadClass(name); return true; } catch (Exception e) { return false; } }
void initializeAdaptor() { try { super.initializeAdaptor(); } catch (Exception e) { // this never happens } }
@Test @InSequence(1) public void testPriorityOnTimerStartEvent() { // when try { deployer.deploy("timerStart"); } catch (Exception e) { e.printStackTrace(); Assert.fail("deployment should be successful, i.e. bean for timer start event should get resolved"); } }
protected void handleBeforeSuiteFailure(Exception e) throws Exception { State.runnerFinished(); if (State.isLastRunner()) { State.clean(); } throw e; }
@Override public Object answer(InvocationOnMock invocation) throws Throwable { super.answer(invocation); return result; } }
@Override public void testRunFinished(Result result) throws Exception { shutdown(getAdaptor()); } });
public Arquillian(Class<?> testClass) throws InitializationError { super(testClass); if (State.isRunningInEclipse()) { State.runnerStarted(); } }
/** * Returns a {@code MethodRuleChain} with a single {@link MethodRule}. This method * is the usual starting point of a {@code MethodRuleChain}. * * @param outerRule the outer rule of the {@code MethodRuleChain}. * @return a {@code MethodRuleChain} with a single {@link MethodRule}. */ public static MethodRuleChain outer(MethodRule outerRule) { return MethodRuleChain.emptyChain().around(outerRule); }
protected Description getFailureDescription() { return getDescription(); } };
@Test @OperateOnDeployment("timerStart") @InSequence(2) public void testAssertPriority() { // then the timer start event job has the priority resolved from the bean Job job = managementService.createJobQuery().activityId("timerStart").singleResult(); Assert.assertNotNull(job); Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); } }
@Test public void shouldReturnExceptionToClientIfAnnotatedExpectedAndFailingOnWrongExceptionThrown() throws Exception { State.caughtTestException(new UnsupportedOperationException()); JUnitTestRunner runner = new JUnitTestRunner(); TestResult result = runner.execute(TestScenarios.class, "shouldFailAnnotatedExpectedWrongException"); Assert.assertEquals(TestResult.Status.FAILED, result.getStatus()); Assert.assertNotNull(result.getThrowable()); Assert.assertEquals(UnsupportedOperationException.class, result.getThrowable().getClass()); }
protected void handleBeforeSuiteFailure(Exception e) throws Exception { State.runnerFinished(); if (State.isLastRunner()) { State.clean(); } throw e; }
@Override public Object answer(InvocationOnMock invocation) throws Throwable { super.answer(invocation); return result; } }
@Override public void testRunFinished(Result result) throws Exception { shutdown(getAdaptor()); } });
public Arquillian(Class<?> testClass) throws InitializationError { super(testClass); if (State.isRunningInEclipse()) { State.runnerStarted(); } }
/** * Returns a {@code MethodRuleChain} with a single {@link MethodRule}. This method * is the usual starting point of a {@code MethodRuleChain}. * * @param outerRule the outer rule of the {@code MethodRuleChain}. * @return a {@code MethodRuleChain} with a single {@link MethodRule}. */ public static MethodRuleChain outer(MethodRule outerRule) { return MethodRuleChain.emptyChain().around(outerRule); }
static boolean isClassPresent(String name) { try { loadClass(name); return true; } catch (Exception e) { return false; } }
@Test public void shouldReturnExceptionToClientIfAnnotatedExpectedAndPassing() throws Exception { State.caughtTestException(new IllegalArgumentException()); JUnitTestRunner runner = new JUnitTestRunner(); TestResult result = runner.execute(TestScenarios.class, "shouldPassAnnotatedExpected"); Assert.assertEquals(TestResult.Status.PASSED, result.getStatus()); Assert.assertNotNull(result.getThrowable()); Assert.assertEquals(IllegalArgumentException.class, result.getThrowable().getClass()); }
@Override public Object answer(InvocationOnMock invocation) throws Throwable { super.answer(invocation); return result; } }