@Test public void test2dup() { System.out.println("process"); PasswordAnalysis password = new PasswordAnalysis("abcabcabc"); PathCost cost = new PathCost(password); cost.addPattern(new PasswordPattern(6, 3, "abc", 100, "test pattern")); cost.addPattern(new PasswordPattern(3, 3, "abc", 100, "test pattern")); cost.addPattern(new PasswordPattern(0, 3, "abc", 100, "test pattern")); RepeatingPatternFinder instance = new RepeatingPatternFinder(); PathCost result = instance.process(cost, password); assertEquals(100, (int) result.getTotalCost()); List<PasswordPattern> pattList = result.getPath(); assertEquals(3, pattList.size()); assertEquals(RepeatingPatternFinder.DUPLICATE_PATTERN, pattList.get(1).getName()); assertEquals(RepeatingPatternFinder.DUPLICATE_PATTERN, pattList.get(2).getName()); }
@Test public void testDupExtra() { System.out.println("process"); PasswordAnalysis password = new PasswordAnalysis("123abc456abc789"); PathCost cost = new PathCost(password); cost.addPattern(new PasswordPattern(9, 3, "abc", 100, "test pattern")); cost.addPattern(new PasswordPattern(3, 3, "abc", 100, "test pattern")); RepeatingPatternFinder instance = new RepeatingPatternFinder(); PathCost result = instance.process(cost, password); List<PasswordPattern> pattList = result.getPath(); assertEquals(2, pattList.size()); assertEquals(RepeatingPatternFinder.DUPLICATE_PATTERN, pattList.get(1).getName()); }