### Question:
IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimiter.equals("")) { String[] paramArr = message.split(delimiter); for (String p : paramArr) { if (Pattern.matches(paramRegex, p) && !Pattern.matches(typeRegex, p)) { pList.add(p); } } } else { Pattern pattern = Pattern.compile(paramRegex); Matcher matcher = pattern.matcher(message.trim()); while (matcher.find()) { String match = matcher.group(); pList.add(match); } } for (String param : pList) { param = param.trim(); param = param.replace(delimiter + delimiter, delimiter); String[] paramParts = param.split(separator); if (paramParts.length == 2) { IncomingMessageFormParameter imParam = coreManager.createIncomingMessageFormParameter(); imParam.setDateCreated(new Date()); imParam.setMessageFormParamStatus(IncMessageFormParameterStatus.NEW); imParam.setName(paramParts[0].trim()); imParam.setValue(paramParts[1].trim()); params.put(imParam.getName().toLowerCase(), imParam); } } return params; }  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);  }### Answer:
@Test public void testGetParams() { System.out.println("getParams"); String message = "Type=GENERAL\naction=test\nmessage=Test, Dream Tester\ndob = 01.01.01\ndue-date=right. now\ntest_format=all"; List<IncomingMessageFormParameter> expResult = new ArrayList<IncomingMessageFormParameter>(); IncomingMessageFormParameter param1 = new IncomingMessageFormParameterImpl(); param1.setName("action"); param1.setValue("test"); expResult.add(param1); IncomingMessageFormParameter param2 = new IncomingMessageFormParameterImpl(); param1.setName("message"); param1.setValue("Test, Dream Tester"); expResult.add(param2); IncomingMessageFormParameter param3 = new IncomingMessageFormParameterImpl(); param1.setName("dob"); param1.setValue("01.01.01"); expResult.add(param3); IncomingMessageFormParameter param4 = new IncomingMessageFormParameterImpl(); param1.setName("due-date"); param1.setValue("right. now"); expResult.add(param4); IncomingMessageFormParameter param5 = new IncomingMessageFormParameterImpl(); param1.setName("test_format"); param1.setValue("all"); expResult.add(param5); expect( mockCore.createIncomingMessageFormParameter() ).andReturn(new IncomingMessageFormParameterImpl()).times(expResult.size()); replay(mockCore); Map<String,IncomingMessageFormParameter> result = imParser.getParams(message); verify(mockCore); assertNotNull(result); assertEquals(result.size(), expResult.size()); }