@Test
public void collect() {

    AtomicBoolean executed = new AtomicBoolean(false);
    TestStatisticCollector statisticCollector = new TestStatisticCollector((t, s) -> {
        if (retries.get() >= 0)
            Assert.assertEquals("foo[name=value]", s);
        else
            Assert.assertEquals("foo[name=value], delayed[name=value]", s);
        executed.set(true);
    });
    statisticCollector.register(new TestStatistic("foo"));
    statisticCollector.delayRegister(this::createTestStatistic);
    for (int i = 0; i < RETRIES_COUNT; i++)
        statisticCollector.collect();
    Assert.assertTrue(executed.get());
}