@Test
    public void testFilterValidWithTwoDuplicateValidCerts() throws Exception
    {
        // Setup fixture.
        final X509Certificate valid = KeystoreTestUtils.generateValidCertificate().getCertificate();
        final Collection<X509Certificate> input = new ArrayList<>();
        input.add( valid );
        input.add( valid );

        // Execute system under test.
        final Collection<X509Certificate> result = CertificateUtils.filterValid( input );

        // Verify results.
        assertEquals( 1, result.size() );
        assertTrue( result.contains( valid ) );
    }
Test for {@link CertificateUtils#filterValid(Collection)}. Verifies that an input argument that
contains two duplicate, valid certificates returns a collection that contains that certificate once.
xmppserver/src/test/java/org/jivesoftware/openfire/keystore/CertificateUtilsTest.java