}
public void testSerialization() throws IOException, ClassNotFoundException {
// construct test object
SimpleNamespaceContext original = new SimpleNamespaceContext();
original.addNamespace("a", "http://www.a.com");
original.addNamespace("b", "http://www.b.com");
// serialize
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(original);
oos.close();
//deserialize
byte[] pickled = out.toByteArray();
InputStream in = new ByteArrayInputStream(pickled);
ObjectInputStream ois = new ObjectInputStream(in);
Object o = ois.readObject();
SimpleNamespaceContext copy = (SimpleNamespaceContext) o;
// test the result
assertEquals("http://www.a.com", copy.translateNamespacePrefixToUri("a"));
assertEquals("http://www.b.com", copy.translateNamespacePrefixToUri("b"));
assertEquals("", "");
}