### Question:
HttpServer { public void registerCommand(String commandName, CommandHandler handler) { if (StringUtil.isEmpty(commandName) || handler == null) { return; } if (handlerMap.containsKey(commandName)) { CommandCenterLog.warn("[NettyHttpCommandCenter] Register failed (duplicate command): " + commandName); return; } handlerMap.put(commandName, handler); }  void start(); void close(); void registerCommand(String commandName, CommandHandler handler); void registerCommands(Map<String, CommandHandler> handlerMap);  }### Answer:
@Test public void testRegisterCommand() { String commandName; CommandHandler handler; commandName = null; handler = new VersionCommandHandler(); httpServer.registerCommand(commandName, handler); assertEquals(0, HttpServer.handlerMap.size()); commandName = ""; handler = new VersionCommandHandler(); httpServer.registerCommand(commandName, handler); assertEquals(0, HttpServer.handlerMap.size()); commandName = "version"; handler = null; httpServer.registerCommand(commandName, handler); assertEquals(0, HttpServer.handlerMap.size()); commandName = "version"; handler = new VersionCommandHandler(); httpServer.registerCommand(commandName, handler); assertEquals(1, HttpServer.handlerMap.size()); commandName = "version"; handler = new VersionCommandHandler(); httpServer.registerCommand(commandName, handler); assertEquals(1, HttpServer.handlerMap.size()); commandName = "basicInfo"; handler = new BasicInfoCommandHandler(); httpServer.registerCommand(commandName, handler); assertEquals(2, HttpServer.handlerMap.size()); }