示例#1
0
        [TestMethod] public void testReadWriteExternal()
        {
            try {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                ObjectOutputStream    objectOutputStream    = new ObjectOutputStream(byteArrayOutputStream);
                mappingProvider.writeExternal(objectOutputStream);
                objectOutputStream.flush();

                MappingFileProvider newMappingProvider = new MappingFileProvider();
                newMappingProvider.readExternal(
                    new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())));
                assertEquals(mappingProvider.toString(), newMappingProvider.toString());
            } catch (IOException e) {
                LOGGER.log(Level.SEVERE, e.getMessage());
                fail();
            }
        }