### Question:
PrintHelper { public void print(final HTMLElement element) { final Window globalWindow = getGlobalWindow(); final Window printWindow = globalWindow.open("", "_blank"); final HTMLDocument printDocument = getWindowDocument(printWindow); writeElementIntoDocument(element, printDocument); changeMediaAttributesToAll(printDocument); copyStylesFromWindow(printDocument, globalWindow); setupPrintCommandOnPageLoad(printDocument, printWindow); }  void print(final HTMLElement element);  }### Answer:
@Test public void testPrint() { final HTMLElement element = mock(HTMLElement.class); final HTMLDocument printDocument = mock(HTMLDocument.class); final Window globalWindow = mock(Window.class); final Window printWindow = mock(Window.class); doReturn(globalWindow).when(helper).getGlobalWindow(); doReturn(printDocument).when(helper).getWindowDocument(printWindow); doNothing().when(helper).writeElementIntoDocument(any(), any()); doNothing().when(helper).changeMediaAttributesToAll(any()); doNothing().when(helper).copyStylesFromWindow(any(), any()); doNothing().when(helper).setupPrintCommandOnPageLoad(any(), any()); when(globalWindow.open("", "_blank")).thenReturn(printWindow); helper.print(element); verify(helper).writeElementIntoDocument(element, printDocument); verify(helper).changeMediaAttributesToAll(printDocument); verify(helper).copyStylesFromWindow(printDocument, globalWindow); verify(helper).setupPrintCommandOnPageLoad(printDocument, printWindow); }