### Question:
ThreadPoolGovernor { public static void registerThreadPoolExecutor(String name, ThreadPoolExecutor threadPoolExecutor) { if (StringUtil.isEmpty(name)) { ThreadLogger.error("Rejected registering request of instance {} with empty name: {}.", threadPoolExecutor, name); return; } ThreadPoolExecutor existingExecutor = registry.putIfAbsent(name, threadPoolExecutor); if (existingExecutor != null) { ThreadLogger.error( "Rejected registering request of instance {} with duplicate name: {}", threadPoolExecutor, name); } else { ThreadLogger.info("Thread pool with name '{}' registered", name); } }  synchronized static void startSchedule(); synchronized static void stopSchedule(); static void registerThreadPoolExecutor(String name, ThreadPoolExecutor threadPoolExecutor); static void registerThreadPoolExecutor(SofaThreadPoolExecutor threadPoolExecutor); static void unregisterThreadPoolExecutor(String name); static ThreadPoolExecutor getThreadPoolExecutor(String name); static long getPeriod(); static void setPeriod(long period); static boolean isLoggable(); static void setLoggable(boolean loggable); static String CLASS_NAME; }### Answer:
@Test public void testSameThreadPoolName() { String threadPoolName = "sameName"; ThreadPoolGovernor.registerThreadPoolExecutor(threadPoolName, new ThreadPoolExecutor(1, 1, 4, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10))); ThreadPoolGovernor.registerThreadPoolExecutor(threadPoolName, new ThreadPoolExecutor(1, 1, 4, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10))); Assert .assertTrue(isLastErrorMatch(String.format( "Rejected registering request of instance .+ with duplicate name: %s", threadPoolName))); }
@Test public void testEmptyThreadPoolName() { ThreadPoolGovernor.registerThreadPoolExecutor("", new ThreadPoolExecutor(1, 1, 4, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10))); ThreadPoolGovernor.registerThreadPoolExecutor(null, new ThreadPoolExecutor(1, 1, 4, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10))); Assert.assertEquals(1, infoListAppender.list.size()); Assert.assertTrue(isMatch(lastWarnString(), ERROR, "Rejected registering request of instance .+")); Assert.assertEquals(2, aberrantListAppender.list.size()); }