@@ -0,0 +1,2485 @@
+/*%0A * Copyright (C) 2008 XStream Committers.%0A * All rights reserved.%0A *%0A * The software in this package is published under the terms of the BSD%0A * style license a copy of which has been included with this distribution in%0A * the LICENSE.txt file.%0A * %0A * Created on 28. October 2008 by Joerg Schaible%0A */%0Apackage com.thoughtworks.acceptance;%0A%0Aimport javax.imageio.ImageIO;%0A%0Aimport java.awt.Color;%0Aimport java.awt.Graphics2D;%0Aimport java.awt.image.BufferedImage;%0Aimport java.awt.image.RenderedImage;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0A%0A%0A/**%0A * Tests with buffered images.%0A * %0A * @author J&ouml;rg Schaible%0A */%0Apublic class BufferedImagesTest extends AbstractAcceptanceTest %7B%0A%0A    public void testInBWCanBeMarshalled() throws IOException %7B%0A        final BufferedImage image = new BufferedImage(3, 3, BufferedImage.TYPE_BYTE_BINARY);%0A        final Graphics2D graphics = image.createGraphics();%0A        graphics.setBackground(Color.WHITE);%0A        graphics.clearRect(0, 0, 2, 2);%0A        graphics.setColor(Color.BLACK);%0A        graphics.drawLine(0, 0, 2, 2);%0A%0A        final ByteArrayOutputStream baosOriginal = new ByteArrayOutputStream();%0A        ImageIO.write(image, %22tiff%22, baosOriginal);%0A%0A        xstream.alias(%22image%22, BufferedImage.class);%0A        final String xml = xstream.toXML(image);%0A%0A        final ByteArrayOutputStream baosSerialized = new ByteArrayOutputStream();%0A        ImageIO.write((RenderedImage)xstream.fromXML(xml), %22tiff%22, baosSerialized);%0A%0A        assertArrayEquals(baosOriginal.toByteArray(), baosSerialized.toByteArray());%0A    %7D%0A%0A    public void testInRGBACanBeMarshalled() throws IOException %7B%0A        final BufferedImage image = new BufferedImage(3, 3, BufferedImage.TYPE_INT_ARGB);%0A        final Graphics2D graphics = image.createGraphics();%0A        graphics.setBackground(Color.WHITE);%0A        graphics.clearRect(0, 0, 2, 2);%0A        graphics.setColor(Color.RED);%0A        graphics.drawLine(0, 0, 2, 2);%0A%0A        final ByteArrayOutputStream baosOriginal = new ByteArrayOutputStream();%0A        ImageIO.write(image, %22png%22, baosOriginal);%0A%0A        xstream.alias(%22image%22, BufferedImage.class);%0A        final String xml = xstream.toXML(image);%0A        System.out.println(xml);%0A%0A        final ByteArrayOutputStream baosSerialized = new ByteArrayOutputStream();%0A        ImageIO.write((RenderedImage)xstream.fromXML(xml), %22png%22, baosSerialized);%0A%0A        assertArrayEquals(baosOriginal.toByteArray(), baosSerialized.toByteArray());%0A    %7D%0A%7D%0A

Add test for BufferedImage.