Tests for writeReplace and readResolve