@Test
    public void testDontOverwriteStanzaIDElement() throws Exception
    {
        // Setup fixture.
        final Packet input = new Message();
        final JID self = new JID( "foobar" );
        final String notExpected = "de305d54-75b4-431b-adb2-eb6b9e546013";
        final Element toOverwrite = input.getElement().addElement( "stanza-id", "urn:xmpp:sid:0" );
        toOverwrite.addAttribute( "by", new JID( "someoneelse" ).toString() );
        toOverwrite.addAttribute( "id", notExpected );

        // Execute system under test.
        final Packet result = StanzaIDUtil.ensureUniqueAndStableStanzaID( input, self );

        // Verify results.
        assertNotNull( result );
        final List<Element> elements = result.getElement().elements( QName.get( "stanza-id", "urn:xmpp:sid:0" ) );
        assertEquals( 2, elements.size() );
    }
Test if {@link StanzaIDUtil#ensureUniqueAndStableStanzaID(Packet, JID)} does not overwrites
a stanza-id element when another is present with a different 'by' value.
xmppserver/src/test/java/org/jivesoftware/openfire/stanzaid/StanzaIDUtilTest.java