@Test
    public void testAverageQueryTime() throws Exception
    {
        // Setup test fixture.
        ProfiledConnection.start();

        // Execute system under test.
        ProfiledConnection.addQuery(ProfiledConnection.Type.select, "SELECT 1", Duration.ofMillis(4));
        ProfiledConnection.addQuery(ProfiledConnection.Type.select, "SELECT 1", Duration.ofMillis(6));
        final Duration result = ProfiledConnection.getAverageQueryTime(ProfiledConnection.Type.select);

        // Verify results.
        assertEquals(Duration.ofMillis(5), result);
    }
Unit tests that verify the functionality of {@link ProfiledConnection}

@author Guus der Kinderen, guus.der.kinderen@gmail.com
xmppserver/src/test/java/org/jivesoftware/database/ProfiledConnectionTest.java