@Test
    public void testSubscribeGeneric() throws InterruptedException {
        JRTConfigRequester requester = new JRTConfigRequester(new MockConnection(), tv);
        GenericConfigSubscriber sub = new GenericConfigSubscriber(requester);
        List<String> defContent = List.of("myVal int");
        GenericConfigHandle handle = sub.subscribe(new ConfigKey<>("simpletypes", "id", "config"),
                                                   defContent,
                                                   tv);
        assertTrue(sub.nextConfig(false));
        assertTrue(handle.isChanged());
        // MockConnection returns empty string
        assertEquals("{}", getConfig(handle));
        assertEquals(1L, handle.getRawConfig().getGeneration());
        assertFalse(sub.nextConfig(false));
        assertFalse(handle.isChanged());

        // Wait some time, config should be the same, but generation should be higher
        Thread.sleep(tv.getFixedDelay() * 3);
        assertEquals("{}", getConfig(handle));
        assertTrue("Unexpected generation (not > 1): " + handle.getRawConfig().getGeneration(), handle.getRawConfig().getGeneration() > 1);
        assertFalse(sub.nextConfig(false));
        assertFalse(handle.isChanged());
    }
Test cases for the "generic" (class-less) subscription mechanism.

@author Ulf Lilleengen
config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java