public void testDuplicates() {
final AssetResolverMock assetResolverMock =
new AssetResolverMock("AssetResolverMock", expectations);
final DOMProtocolMock protocolMock =
new DOMProtocolMock("DOMProtocolMock", expectations,
new DefaultProtocolSupportFactory(), null);
protocolMock.expects.pushHeadBuffer().any();
final List scriptAttributesList = new LinkedList();
protocolMock.fuzzy.writeOpenScript(mockFactory.expectsAny()).does(
new MethodAction() {
public Object perform(MethodActionEvent event) {
scriptAttributesList.add(event.getArguments()[0]);
return null;
}
}).any();
protocolMock.fuzzy.writeCloseScript(mockFactory.expectsAny()).returns().any();
protocolMock.expects.popHeadBuffer().any();
protocolMock.expects.getDOMFactory().returns(
DOMFactory.getDefaultInstance()).any();
final PageHead pageHead = new PageHead();
pageHead.setOutputBufferFactory(
new DOMOutputBufferFactory(DOMFactory.getDefaultInstance()));
protocolMock.expects.getPageHead().returns(pageHead).any();
protocolMock.fuzzy.createScriptElement(
mockFactory.expectsInstanceOf(ScriptAttributes.class)).does(
new MethodAction(){
public Object perform(final MethodActionEvent event)
throws Throwable {
final ScriptAttributes attributes =
(ScriptAttributes) event.getArguments()[0];
final Element scriptElement =
protocolMock.getDOMFactory().createElement("script");
scriptElement.setAttribute("charset",
attributes.getCharSet());
scriptElement.setAttribute("language",
attributes.getLanguage());
scriptElement.setAttribute("src",