@Test
public void testSerializationFailure() {

	try {
		// a mock serializer that fails when writing
		CollectionInputFormat<ElementType> inFormat = new CollectionInputFormat<ElementType>(
				Collections.singleton(new ElementType()), new TestSerializer(false, true));
		
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		ObjectOutputStream out = new ObjectOutputStream(buffer);
		
		try {
			out.writeObject(inFormat);
			fail("should throw an exception");
		}
		catch (TestException e) {
			// expected
		}
		catch (Exception e) {
			fail("Exception not properly forwarded");
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}