public int getReferenceCount() {
        return referenceCount;
    }
@Test
    void testConcurrency() throws InterruptedException {
        TestReferenceCounted referenceCounted = new TestReferenceCounted();
        List<Thread> threads = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            Thread thread = new Thread(referenceCounted::retain);
            thread.start();
            threads.add(thread);
        }
        for (int i = 0; i < 5; i++) {
            Thread thread = new Thread(referenceCounted::release);
            thread.start();
            threads.add(thread);
        }
        for (Thread thread : threads) {
            thread.join();
        }
        assertThat(referenceCounted.getReferenceCount()).isEqualTo(0);
    }