@Test
    public void testExternalizedEquals() throws Exception
    {
        // Setup test fixture.
        final HistoryStrategy input = dummyHistoryStrategy();
        populateField(input, "parent", dummyHistoryStrategy()); // Use another instance as the parent for our input instance.

        // Execute system under test.
        final byte[] serialized;
        try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
             final ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
            oos.writeObject(input);
            serialized = baos.toByteArray();
        }

        final Object result;
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(serialized);
             final ObjectInputStream ois = new ObjectInputStream(bais)) {
            result = ois.readObject();
        }

        // Verify results.
        assertNotNull(result);
        assertTrue(result instanceof HistoryStrategy);
        assertEquals(input, result);
        assertEquals(input.getType(), ((HistoryStrategy) result).getType());
        assertEquals(input.getMaxNumber(), ((HistoryStrategy) result).getMaxNumber());
        assertNotNull(input.getChangedSubject());
        assertNotNull(((HistoryStrategy) result).getChangedSubject());
        assertEquals(input.getChangedSubject().toXML(), ((HistoryStrategy) result).getChangedSubject().toXML());

        final AbstractList<String> inputMessageTextHistory = new ArrayList<>();
        final ListIterator<Message> inputReverseMessageHistory = input.getReverseMessageHistory();
        while(inputReverseMessageHistory.hasNext()) {
            inputMessageTextHistory.add(inputReverseMessageHistory.next().toXML());
        }

        final AbstractList<String> resultMessageTextHistory = new ArrayList<>();
        final ListIterator<Message> resultReverseMessageHistory = input.getReverseMessageHistory();
        while(resultReverseMessageHistory.hasNext()) {
            resultMessageTextHistory.add(resultReverseMessageHistory.next().toXML());
        }

        assertEquals(inputMessageTextHistory, resultMessageTextHistory);
    }
Asserts that when a populated instance of HistoryStrategy is serialized and the resulting data deserialized again, an
instance results that is equal to the original input.
xmppserver/src/test/java/org/jivesoftware/openfire/muc/HistoryStrategyTest.java