    @Test
    @Disabled("time-based, non-deterministic")
    void deregisterQueryTest() throws InterruptedException {

        try {
            QueryRegistry queryRegistry = new QueryRegistry.Builder().build();
            fail();
        } catch (IllegalArgumentException ignored) { }

        QueryRegistry queryRegistry = new QueryRegistry.Builder().withClientIdPrefix("myPrefix").build();

        String targetApp = "myapp";
        try {
            queryRegistry.registerQuery(targetApp, null, "true");
            fail();
        } catch (Exception ignored) {

        }

        try {
            queryRegistry.registerQuery(targetApp, "subId", null);
            fail();
        } catch (Exception ignored) {

        }

        queryRegistry.registerQuery(targetApp, "subId", "true");

        List<MantisServerSubscription> currentSubs = queryRegistry.getCurrentSubscriptionsForApp(targetApp);

        assertEquals(1, currentSubs.size());

        queryRegistry.deregisterQuery(targetApp, "subId", "true");

        Thread.sleep(500);

        currentSubs = queryRegistry.getCurrentSubscriptionsForApp(QueryRegistry.ANY);

        assertEquals(0, currentSubs.size());
    }