public void add(T element) {
        Preconditions.checkNotNull(element);
        if (elements.add(element) && elements.size() > maxSize) {
            elements.poll();
        }
    }
@Test
    void testSizeWithMaxSize2() {
        final BoundedFIFOQueue<Integer> testInstance = new BoundedFIFOQueue<>(2);
        assertThat(testInstance).isEmpty();

        testInstance.add(5);
        assertThat(testInstance).hasSize(1);

        testInstance.add(6);
        assertThat(testInstance).hasSize(2);

        // adding a 3rd element won't increase the size anymore
        testInstance.add(7);
        assertThat(testInstance).hasSize(2);
    }