コード例 #1
0
  @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());
  }
コード例 #2
0
  @Test
  public void testNonDup() {
    System.out.println("process");

    PasswordAnalysis password = new PasswordAnalysis("abcabc");
    PathCost cost = new PathCost(password);
    cost.addPattern(new PasswordPattern(3, 3, "abc", 100, "test pattern"));
    cost.addPattern(new PasswordPattern(0, 3, "xyz", 100, "test pattern"));

    RepeatingPatternFinder instance = new RepeatingPatternFinder();
    PathCost result = instance.process(cost, password);
    assertEquals(100 * 100, (int) result.getTotalCost());
    List<PasswordPattern> pattList = result.getPath();
    assertEquals(2, pattList.size());
    assertNotSame(RepeatingPatternFinder.DUPLICATE_PATTERN, pattList.get(1).getName());
  }