beanDefinitionContext = createApplicationContext("context");
Map<String, SequenceAfterSuite> container = beanDefinitionContext.getBeansOfType(SequenceAfterSuite.class);
Assert.assertEquals(container.size(), 2L);
SequenceAfterSuite sequenceAfter = container.get("afterSuite");
Assert.assertEquals(sequenceAfter.getName(), "afterSuite");
Assert.assertEquals(sequenceAfter.getSuiteNames().size(), 0L);
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("", null));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteA", null));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteB", null));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteZ", new String[] {"unit"}));
sequenceAfter.execute(context);
sequenceAfter = container.get("afterSuite2");
Assert.assertEquals(sequenceAfter.getName(), "afterSuite2");
Assert.assertEquals(sequenceAfter.getSuiteNames().size(), 2L);
Assert.assertEquals(sequenceAfter.getTestGroups().size(), 2L);
Assert.assertEquals(sequenceAfter.getActions().size(), 1L);
Assert.assertFalse(sequenceAfter.shouldExecute("", null));
Assert.assertFalse(sequenceAfter.shouldExecute("suiteA", null));
Assert.assertFalse(sequenceAfter.shouldExecute("suiteB", null));
Assert.assertFalse(sequenceAfter.shouldExecute("suiteZ", null));
Assert.assertFalse(sequenceAfter.shouldExecute("suiteZ", new String[]{}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteZ", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteZ", new String[]{"e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteA", new String[]{"unit"}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteB", new String[]{"other", "unit", "e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteA", new String[] {"e2e"}));
Assert.assertTrue(sequenceAfter.shouldExecute("suiteB", new String[] {"other", "unit", "e2e"}));
Assert.assertEquals(sequenceAfter.getActions().get(0).getClass(), SleepAction.class);
sequenceAfter.execute(context);
}