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"; }    }
@Test public void should_accept_missing_input() { assertEquals(server.answer(null), "team name"); }
@Test public void should_add_numbers() { assertEquals(server.answer("what is the sum of 14 and 4"), "18"); }