beanDefinitionContext = createApplicationContext("context");
Map<String, SequenceBeforeSuite> container = beanDefinitionContext.getBeansOfType(SequenceBeforeSuite.class);
Assert.assertEquals(container.size(), 2L);
SequenceBeforeSuite sequenceBefore = container.get("beforeSuite");
Assert.assertEquals(sequenceBefore.getName(), "beforeSuite");
Assert.assertEquals(sequenceBefore.getSuiteNames().size(), 0L);
Assert.assertEquals(sequenceBefore.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceBefore.getActions().size(), 3L);
Assert.assertEquals(sequenceBefore.getActions().get(0).getClass(), EchoAction.class);
Assert.assertEquals(sequenceBefore.getActions().get(1).getClass(), CustomTestAction.class);
Assert.assertEquals(sequenceBefore.getActions().get(2).getClass(), EchoAction.class);
Assert.assertTrue(sequenceBefore.shouldExecute("", null));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteA", null));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteB", null));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteZ", new String[] {"unit"}));
sequenceBefore.execute(context);
sequenceBefore = container.get("beforeSuite2");
Assert.assertEquals(sequenceBefore.getName(), "beforeSuite2");
Assert.assertEquals(sequenceBefore.getSuiteNames().size(), 2L);
Assert.assertEquals(sequenceBefore.getTestGroups().size(), 2L);
Assert.assertEquals(sequenceBefore.getActions().size(), 1L);
Assert.assertFalse(sequenceBefore.shouldExecute("", null));
Assert.assertFalse(sequenceBefore.shouldExecute("suiteA", null));
Assert.assertFalse(sequenceBefore.shouldExecute("suiteB", null));
Assert.assertFalse(sequenceBefore.shouldExecute("suiteZ", null));
Assert.assertFalse(sequenceBefore.shouldExecute("suiteZ", new String[]{}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteZ", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteZ", new String[]{"e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteA", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteB", new String[]{"other", "unit", "e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteA", new String[] {"e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("suiteB", new String[] {"other", "unit", "e2e"}));
Assert.assertEquals(sequenceBefore.getActions().get(0).getClass(), SleepAction.class);
sequenceBefore.execute(context);
}