WikiInputValidation { public static boolean validatePageName(String inputPageName) { Pattern pattern = Pattern.compile(pageNameRegExp); Matcher matcher = pattern.matcher(inputPageName); return matcher.matches(); }  static boolean validatePageName(String inputPageName);  }
@Test public void testInputValidation_accepts_umlaut() { String pageNameOK = "Artikel für test 1"; boolean isValid = WikiInputValidation.validatePageName(pageNameOK); assertTrue(isValid); }
@Test public void testInputValidation_refuses_lessthen() { String pageNameOK = "<script>"; boolean isValid = WikiInputValidation.validatePageName(pageNameOK); assertFalse(isValid); }
@Test public void testInputValidation_refuses_singlequotes() { String pageNameOK = "alert('xss')"; boolean isValid = WikiInputValidation.validatePageName(pageNameOK); assertFalse(isValid); }