beanDefinitionContext = createApplicationContext("context");
Map<String, SequenceBeforeTest> container = beanDefinitionContext.getBeansOfType(SequenceBeforeTest.class);
Assert.assertEquals(container.size(), 4L);
SequenceBeforeTest sequenceBefore = container.get("beforeTest");
Assert.assertEquals(sequenceBefore.getName(), "beforeTest");
Assert.assertNull(sequenceBefore.getNamePattern());
Assert.assertNull(sequenceBefore.getPackageNamePattern());
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("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Interface_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceBefore = container.get("beforeTest2");
Assert.assertEquals(sequenceBefore.getName(), "beforeTest2");
Assert.assertEquals(sequenceBefore.getNamePattern(), "*OK_Test");
Assert.assertNull(sequenceBefore.getPackageNamePattern());
Assert.assertEquals(sequenceBefore.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceBefore.getActions().size(), 1L);
Assert.assertEquals(sequenceBefore.getActions().get(0).getClass(), EchoAction.class);
Assert.assertTrue(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Interface_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceBefore = container.get("beforeTest3");
Assert.assertEquals(sequenceBefore.getName(), "beforeTest3");
Assert.assertNull(sequenceBefore.getNamePattern());
Assert.assertEquals(sequenceBefore.getPackageNamePattern(), "com.consol.citrus.database");
Assert.assertEquals(sequenceBefore.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceBefore.getActions().size(), 1L);
Assert.assertEquals(sequenceBefore.getActions().get(0).getClass(), EchoAction.class);
Assert.assertFalse(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceBefore.shouldExecute("Interface_OK_Test", "com.consol.citrus.database", new String[] {"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceBefore.execute(context);
sequenceBefore = container.get("beforeTest4");
Assert.assertEquals(sequenceBefore.getName(), "beforeTest4");
Assert.assertEquals(sequenceBefore.getNamePattern(), "*OK_Test");
Assert.assertEquals(sequenceBefore.getPackageNamePattern(), "com.consol.citrus.database");
Assert.assertEquals(sequenceBefore.getTestGroups().size(), 2L);
Assert.assertEquals(sequenceBefore.getActions().size(), 1L);
Assert.assertEquals(sequenceBefore.getActions().get(0).getClass(), EchoAction.class);
Assert.assertFalse(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", new String[]{}));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertFalse(sequenceBefore.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Database_OK_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Interface_OK_Test", "com.consol.citrus.database", new String[]{"e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("OK_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[]{"other", "unit", "e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[] {"e2e"}));
Assert.assertTrue(sequenceBefore.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[] {"other", "unit", "e2e"}));
sequenceBefore.execute(context);
}