[TestMethod] public void testReadExternalThrowsIOExceptionWithMalformedData() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeUTF("hello"); objectOutputStream.flush(); ObjectInputStream objectInputStream = new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())); FlyweightMapStorage newMapStorage = new FlyweightMapStorage(); try { newMapStorage.readExternal(objectInputStream); fail(); } catch (IOException) { // Exception expected. } }
public override void writeUTF(string s) { output.writeUTF(s); }