@Test public void before() {

    Document doc = Jsoup.parse("<p>One <b>two</b> three</p>");
    Element newNode = new Element(Tag.valueOf("em"), "");
    newNode.appendText("four");
    doc.select("b").first().before(newNode);
    assertEquals("<p>One <em>four</em><b>two</b> three</p>", doc.body().html());
    doc.select("b").first().before("<i>five</i>");
    assertEquals("<p>One <em>four</em><i>five</i><b>two</b> three</p>", doc.body().html());
}