@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"); } }
@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 @InSequence(1) public void timedMethodNotCalledYet() { // Make sure that the timer hasn't been called yet assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L))); }
@Test @InSequence(1) public void gaugeCalledWithDefaultValue() { // Make sure that the gauge has the expected value assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(0L))); }
@Test @InSequence(1) public void meteredMethodsNotCalledYet() { assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(METER_NAMES))); assertThat("Constructor meter count is incorrect", registry.getMeters().get(CONSTRUCTOR_METER_NAME).getCount(), is(equalTo(CONSTRUCTOR_COUNT.incrementAndGet()))); // Make sure that the method meters haven't been marked yet assertThat("Method meter counts are incorrect", registry.getMeters(METHOD_METERS).values(), everyItem(Matchers.<Meter>hasProperty("count", equalTo(METHOD_COUNT.get())))); }
@Test @InSequence(1) public void timedMethodsNotCalledYet() { assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(TIMER_NAMES))); assertThat("Constructor timer count is incorrect", registry.getTimers().get(CONSTRUCTOR_TIMER_NAME).getCount(), is(equalTo(1L))); // Make sure that the method timers haven't been timed yet assertThat("Method timer counts are incorrect", registry.getTimers(METHOD_TIMERS).values(), everyItem(Matchers.<Timer> hasProperty("count", equalTo(METHOD_COUNT.get())))); }
@Test @InSequence(1) public void timedMethodNotCalledYet() { // Get a contextual instance of the bean TimedMethodBean1 bean = instance.get(); assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME)); Timer timer = registry.getTimers().get(TIMER_NAME); // Make sure that the timer hasn't been called yet assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(TIMER_COUNT.get()))); }
@Test @InSequence(1) public void one() { } }
@Test @InSequence(1) public void timedMethodsNotCalledYet() { assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames()))); // Make sure that all the timers haven't been called yet assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(0L)))); }
@Test @InSequence(2) public void incrementCounterField() { assertThat("Counter is not registered correctly", registry.getCounters(), hasKey(COUNTER_NAME)); Counter counter = registry.getCounters().get(COUNTER_NAME); // Call the increment method and assert the counter is up-to-date long value = Math.round(Math.random() * Long.MAX_VALUE); bean.increment(value); assertThat("Counter value is incorrect", counter.getCount(), is(equalTo(value))); } }
@Test @InSequence(0) public void init() { Assert.assertEquals(0, ActionPortlet.count); }
@Test @InSequence(0) public void testBefore() { Assert.assertFalse(LifeCyclePortlet.started); }
@Test @InSequence(2) public void testAfterDispay() { Assert.assertNull(RenderFormParameterPortlet.foo); Assert.assertEquals(PortletMode.VIEW, RenderFormParameterPortlet.mode); Assert.assertEquals(WindowState.NORMAL, RenderFormParameterPortlet.windowState); }
@Test @InSequence(4) public void testInvoked() { Assert.assertNotNull(RenderURLParameterPortlet.foo); Assert.assertEquals(Collections.singletonList("foo_value"), Arrays.asList(RenderURLParameterPortlet.foo)); Assert.assertEquals(PortletMode.EDIT, RenderURLParameterPortlet.mode); Assert.assertEquals(WindowState.MAXIMIZED, RenderURLParameterPortlet.windowState); } }
@Test @InSequence(2) public void testInvoked() { Assert.assertEquals(2, RenderURLPortlet.count); } }
@Test @InSequence(2) public void testParams() { Assert.assertEquals(2, ResourcePortlet.count); Assert.assertEquals("foo_value", ResourcePortlet.foo); Assert.assertNull(ResourcePortlet.bar); Assert.assertNull("id_value", ResourcePortlet.resourceId); }
/** * This is not a real test method. * * @see #testEnhancedListenerDoesNotDestroyWeldIfListenerRegistered(URL) */ @Test @InSequence(1) public void deployArchives() { // In order to use @ArquillianResource URLs we need to deploy both test archives first deployer.deploy(TEST); deployer.deploy(ASSERT); }
@Test @InSequence(1) public void timedMethodNotCalledYet(MetricRegistry registry) { assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMED_NAME)); Timer timer = registry.getTimers().get(TIMED_NAME); // Make sure that the timer hasn't been called yet assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L))); }
@Test @InSequence(2) public void callTimedMethodOnce() { assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME)); Timer timer = registry.getTimers().get(TIMER_NAME); // Call the timed method and assert it's been timed bean.applicationScopedTimedMethod(); // Make sure that the timer has been called assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L))); } }
@Test @InSequence(3) public void callTimedMethodOnce(MetricRegistry registry) { assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMED_NAME)); Timer timer = registry.getTimers().get(TIMED_NAME); // Call the timed method and assert it's been timed bean.timedMethod(); // Make sure that the timer has been called assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L))); }