### Question:
PrintHelper { void writeElementIntoDocument(final HTMLElement element, final HTMLDocument document) { document.open(); document.write(element.innerHTML); document.close(); document.body.classList.add(PREVIEW_SCREEN_CSS_CLASS); }  void print(final HTMLElement element);  }### Answer:
@Test public void testWriteElementIntoDocument() { final HTMLElement element = mock(HTMLElement.class); final HTMLDocument document = mock(HTMLDocument.class); final HTMLBodyElement body = mock(HTMLBodyElement.class); final String elementHTML = "<html />"; final DOMTokenList classList = mock(DOMTokenList.class); element.innerHTML = elementHTML; document.body = body; body.classList = classList; helper.writeElementIntoDocument(element, document); verify(document).open(); verify(document).write(elementHTML); verify(document).close(); verify(classList).add(PREVIEW_SCREEN_CSS_CLASS); }