@Test public void testGetComand() { System.out.println("getComand"); String message = "Type=GENERAL\naction=test\nmessage=Test,, Tester"; String expResult = "type"; String result = imParser.getCommand(message); assertEquals(expResult, result); message = "someting=test Type"; expResult = ""; result = imParser.getCommand(message); assertEquals(expResult, result); }
public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); }
IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } }
IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); }  }
IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); }  IncomingMessage parseRequest(String message); String getCommand(String message); String getFormCode(String message); Map<String, IncomingMessageFormParameter> getParams(String message); void setCoreManager(CoreManager coreManager); void setDelimiter(String delimiter); void setCmdRegex(String cmdRegex); void setTypeRegex(String typeRegex); void setParamRegex(String paramRegex); void setSeparator(String separator); }
IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); }  IncomingMessage parseRequest(String message); String getCommand(String message); String getFormCode(String message); Map<String, IncomingMessageFormParameter> getParams(String message); void setCoreManager(CoreManager coreManager); void setDelimiter(String delimiter); void setCmdRegex(String cmdRegex); void setTypeRegex(String typeRegex); void setParamRegex(String paramRegex); void setSeparator(String separator);  }