@Test public void should_add_numbers() { assertEquals(server.answer("what is the sum of 14 and 4"), "18"); }
String answer(String parameter) { if (parameter == null) return "team name"; Matcher additionMatcher = Pattern.compile(".*what is the sum of (\\d+) and (\\d+)").matcher(parameter); if (additionMatcher.matches()) { return String.valueOf(Integer.parseInt(additionMatcher.group(1)) + Integer.parseInt(additionMatcher.group(2))); } return "team name"; }
ExtremeStartup extends HttpServlet { String answer(String parameter) { if (parameter == null) return "team name"; Matcher additionMatcher = Pattern.compile(".*what is the sum of (\\d+) and (\\d+)").matcher(parameter); if (additionMatcher.matches()) { return String.valueOf(Integer.parseInt(additionMatcher.group(1)) + Integer.parseInt(additionMatcher.group(2))); } return "team name"; } }
ExtremeStartup extends HttpServlet { String answer(String parameter) { if (parameter == null) return "team name"; Matcher additionMatcher = Pattern.compile(".*what is the sum of (\\d+) and (\\d+)").matcher(parameter); if (additionMatcher.matches()) { return String.valueOf(Integer.parseInt(additionMatcher.group(1)) + Integer.parseInt(additionMatcher.group(2))); } return "team name"; }  }
ExtremeStartup extends HttpServlet { String answer(String parameter) { if (parameter == null) return "team name"; Matcher additionMatcher = Pattern.compile(".*what is the sum of (\\d+) and (\\d+)").matcher(parameter); if (additionMatcher.matches()) { return String.valueOf(Integer.parseInt(additionMatcher.group(1)) + Integer.parseInt(additionMatcher.group(2))); } return "team name"; }   }
ExtremeStartup extends HttpServlet { String answer(String parameter) { if (parameter == null) return "team name"; Matcher additionMatcher = Pattern.compile(".*what is the sum of (\\d+) and (\\d+)").matcher(parameter); if (additionMatcher.matches()) { return String.valueOf(Integer.parseInt(additionMatcher.group(1)) + Integer.parseInt(additionMatcher.group(2))); } return "team name"; }    }