beanDefinitionContext = createApplicationContext("context");
Map<String, SequenceAfterTest> container = beanDefinitionContext.getBeansOfType(SequenceAfterTest.class);
Assert.assertEquals(container.size(), 4L);
SequenceAfterTest sequenceAfter = container.get("afterTest");
Assert.assertEquals(sequenceAfter.getName(), "afterTest");
Assert.assertNull(sequenceAfter.getNamePattern());
Assert.assertNull(sequenceAfter.getPackageNamePattern());
Assert.assertEquals(sequenceAfter.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceAfter.getActions().size(), 3L);
Assert.assertEquals(sequenceAfter.getActions().get(0).getClass(), EchoAction.class);
Assert.assertEquals(sequenceAfter.getActions().get(1).getClass(), CustomTestAction.class);
Assert.assertEquals(sequenceAfter.getActions().get(2).getClass(), EchoAction.class);
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Interface_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceAfter = container.get("afterTest2");
Assert.assertEquals(sequenceAfter.getName(), "afterTest2");
Assert.assertEquals(sequenceAfter.getNamePattern(), "*OK_Test");
Assert.assertNull(sequenceAfter.getPackageNamePattern());
Assert.assertEquals(sequenceAfter.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceAfter.getActions().size(), 1L);
Assert.assertEquals(sequenceAfter.getActions().get(0).getClass(), EchoAction.class);
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Interface_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceAfter = container.get("afterTest3");
Assert.assertEquals(sequenceAfter.getName(), "afterTest3");
Assert.assertNull(sequenceAfter.getNamePattern());
Assert.assertEquals(sequenceAfter.getPackageNamePattern(), "com.consol.citrus.database");
Assert.assertEquals(sequenceAfter.getTestGroups().size(), 0L);
Assert.assertEquals(sequenceAfter.getActions().size(), 1L);
Assert.assertEquals(sequenceAfter.getActions().get(0).getClass(), EchoAction.class);
Assert.assertFalse(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertTrue(sequenceAfter.shouldExecute("Interface_OK_Test", "com.consol.citrus.database", new String[] {"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
sequenceAfter.execute(context);
sequenceAfter = container.get("afterTest4");
Assert.assertEquals(sequenceAfter.getName(), "afterTest4");
Assert.assertEquals(sequenceAfter.getNamePattern(), "*OK_Test");
Assert.assertEquals(sequenceAfter.getPackageNamePattern(), "com.consol.citrus.database");
Assert.assertEquals(sequenceAfter.getTestGroups().size(), 2L);
Assert.assertEquals(sequenceAfter.getActions().size(), 1L);
Assert.assertEquals(sequenceAfter.getActions().get(0).getClass(), EchoAction.class);
Assert.assertFalse(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus", null));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", null));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", null));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", new String[]{}));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus", new String[]{"unit"}));
Assert.assertFalse(sequenceAfter.shouldExecute("Database_Failed_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Database_OK_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Interface_OK_Test", "com.consol.citrus.database", new String[]{"e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("OK_Test", "com.consol.citrus.database", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[]{"other", "unit", "e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[] {"e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("Foo_OK_Test", "com.consol.citrus.database", new String[] {"other", "unit", "e2e"}));
sequenceAfter.execute(context);
}