// Create Mocks
// =====================================================================
StatefulPseudoClass hover = StatefulPseudoClasses.HOVER;
StatefulPseudoClass visited = StatefulPseudoClasses.VISITED;
StatefulPseudoClassSet hoverVisited = hover.getSet().add(visited);
// StatefulPseudoClassMock hoverMock = new StatefulPseudoClassMock(
// "hover", expectations);
//
// StatefulPseudoClassMock visitedMock = new StatefulPseudoClassMock(
// "visited", expectations);
//
// StatefulPseudoClassMock hoverVisitedMock = new StatefulPseudoClassMock(
// "hover:visited", expectations);
// =====================================================================
// Set Expectations
// =====================================================================
pseudoEntityProviderMock.expects.getStatefulPseudoClass("hover")
.returns(hover);
pseudoEntityProviderMock.expects.getStatefulPseudoClass("visited")
.returns(visited);
factoryMock.expects.createUniversalMatcher().returns(universalMock);
// Set the expectations on the specificity calculator.
specificityCalculatorMock.expects.addPseudoClassSelector();
specificityCalculatorMock.expects.addPseudoClassSelector();
// =====================================================================
// Test Expectations
// =====================================================================
List selectors = new ArrayList();
PseudoClassSelector themeSelector =
themeModelFactory.createPseudoClassSelector("hover");
selectors.add(themeSelector);
themeSelector = themeModelFactory.createPseudoClassSelector("visited");
selectors.add(themeSelector);
SelectorSequence sequence = createSelectorSequence(selectors);
MatcherBuilder builder = createMatcherBuilder();
Matcher matcher = builder.getMatcher(sequence);
assertSame("Constructed matcher not as expected",
universalMock, matcher);
List entities = builder.getPseudoStyleEntities();
assertEquals("List should contain one item", 1, entities.size());
StatefulPseudoClassSet actual = (StatefulPseudoClassSet) entities.get(0);
assertEquals("Pseudo class set not as expected", hoverVisited, actual);
}