@Test public void testRepeatMatching() throws Exception { List<Match> actualMatches = new RepeatMatcher().execute(password); assertMatches("matches embedded repeat patterns", Pattern.Repeat, new ExpectedMatch[]{expectedMatch}, actualMatches); }
@Override public List<Match> execute(String password) { List<Match> matches = new ArrayList<>(); List<Matcher> matchers = new ArrayList<>(); matchers.add(new DictionaryMatcher(dictionaries)); matchers.add(new ReverseDictionaryMatcher(dictionaries)); matchers.add(new L33tMatcher(dictionaries)); matchers.add(new SpatialMatcher()); matchers.add(new RepeatMatcher()); matchers.add(new SequenceMatcher()); matchers.add(new RegexMatcher()); matchers.add(new DateMatcher()); for (Matcher matcher: matchers) matches.addAll(matcher.execute(password)); return this.sorted(matches); } }
@Override public List<Match> execute(String password) { List<Match> matches = new ArrayList<>(); List<Matcher> matchers = new ArrayList<>(); matchers.add(new DictionaryMatcher(dictionaries)); matchers.add(new ReverseDictionaryMatcher(dictionaries)); matchers.add(new L33tMatcher(dictionaries)); matchers.add(new SpatialMatcher()); matchers.add(new RepeatMatcher()); matchers.add(new SequenceMatcher()); matchers.add(new RegexMatcher()); matchers.add(new DateMatcher()); for (Matcher matcher: matchers) matches.addAll(matcher.execute(password)); return this.sorted(matches); } }
@Test public void testRepeatMatchingSimple() throws Exception { String msg = String.format("doesn't match length-%s repeat patterns", password.length()); assertEquals(msg, new RepeatMatcher().execute(password).size(), size); }