CommandConfigImpl implements CommandConfig { @Override public boolean isCommandKey(final String key) { return cmdKeys.contains(key); }  void setCmdKeys(final List<String> cmdKeys); void setCmdInternalKeys(final List<String> cmdKeys); @Override boolean isCommandKey(final String key); @Override boolean isInternalCommandKey(final String key);  }
@Test public void testIsCommandKey() throws Exception { final CommandConfigImpl config = new CommandConfigImpl(); config.setCmdKeys(Arrays.asList( "cmd1", "cmd2", "cmd3", "cmd4", "cmd5" )); config.setCmdInternalKeys(Arrays.asList( "cmd2", "cmd4" )); assertTrue(config.isCommandKey("cmd1")); assertTrue(config.isCommandKey("cmd2")); assertTrue(config.isCommandKey("cmd3")); assertTrue(config.isCommandKey("cmd4")); assertTrue(config.isCommandKey("cmd5")); assertFalse(config.isCommandKey("cmd6")); assertFalse(config.isCommandKey("aaa")); assertFalse(config.isInternalCommandKey("cmd1")); assertTrue(config.isInternalCommandKey("cmd2")); assertFalse(config.isInternalCommandKey("cmd3")); assertTrue(config.isInternalCommandKey("cmd4")); assertFalse(config.isInternalCommandKey("cmd5")); assertFalse(config.isInternalCommandKey("cmd6")); assertFalse(config.isInternalCommandKey("aaa")); }