@Test
public void writesObjectToOutputStream() throws Exception {

    Book book = createBook();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    writer.writeTo(book, Book.class, Book.class, null, APPLICATION_XML_TYPE, null, out);
    Book unmarshaledBook = unmarshalBook(out.toByteArray());
    assertEquals(book.getTitle(), unmarshaledBook.getTitle());
    assertEquals(book.isSendByPost(), unmarshaledBook.isSendByPost());
    assertEquals(book.getAuthor(), unmarshaledBook.getAuthor());
    assertEquals(book.getPrice().getCurrency(), unmarshaledBook.getPrice().getCurrency());
    assertEquals(book.getPrice().getValue(), unmarshaledBook.getPrice().getValue());
    assertEquals(book.getMemberPrice().getCurrency(), unmarshaledBook.getMemberPrice().getCurrency());
    assertEquals(book.getMemberPrice().getValue(), unmarshaledBook.getMemberPrice().getValue());
}