@Override
    public Thread newThread(Runnable r) {
        String name = prefix + "_" + counter.incrementAndGet();
        if (totalSize > 1) {
            name += "_" + totalSize;
        }
        Thread thread = new FastThreadLocalThread(group, r, name);

        thread.setDaemon(makeDaemons);
        if (thread.getPriority() != Thread.NORM_PRIORITY) {
            thread.setPriority(Thread.NORM_PRIORITY);
        }
        return thread;
    }
@Test
    public void testNamedThreadFactoryWithSecurityManager() {
        NamedThreadFactory factory = new NamedThreadFactory("testThreadGroup", true);
        Thread thread = factory.newThread(() -> {});
        assertThat(thread.getThreadGroup()).isNotNull();
    }