### Question:
LoginController { boolean isValidSub(String sub) { URL url = null; try { url = new URL(sub); } catch (MalformedURLException ex) { logger.error("can't parse url", ex); return false; } String bare = url.getHost().replaceAll("." + envConfig.getExternalApex(), ""); Map<String, Service> serviceMap = ServiceDirectory.getMapping(); for(String key : serviceMap.keySet()) { if (key.equals(bare)) { return true; } } return false; }  @RequestMapping(value = "/login") String login(@RequestParam(value="return_to", required = false) String returnTo, // POST and GET are in the same handler - reset
                        @RequestParam(value="email", required = false) String email,
                        @RequestParam(value="password", required = false) String password,
                        // rememberMe=True means that the session is set for a month instead of a day
                        @RequestParam(value="remember-me", required = false) String rememberMe,
                        Model model,
                        HttpServletRequest request,
                        HttpServletResponse response);  }### Answer:
@Test public void testIsValidSub() { assertThat(loginController.isValidSub("http: assertThat(loginController.isValidSub("httpxxx: assertThat(loginController.isValidSub("http: assertThat(loginController.isValidSub("http: }