Here you can find the source of serializeMock(Object mock)
public static ByteArrayOutputStream serializeMock(Object mock) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static ByteArrayOutputStream serializeMock(Object mock) throws IOException { ByteArrayOutputStream serialized = new ByteArrayOutputStream(); new ObjectOutputStream(serialized).writeObject(mock); return serialized; }/* w w w. ja v a 2 s . co m*/ }