public void testIsDuplicateString(){
  int count=10000;
  ActiveMQMessageAudit audit=new ActiveMQMessageAudit();
  IdGenerator idGen=new IdGenerator();
  List<String> list=new ArrayList<>();
  for (int i=0; i < count; i++) {
    String id=idGen.generateId();
    list.add(id);
    assertFalse(audit.isDuplicate(id));
  }
  List<String> windowList=list.subList(list.size() - 1 - audit.getAuditDepth(),list.size() - 1);
  for (  String id : windowList) {
    assertTrue("duplicate, id:" + id,audit.isDuplicate(id));
  }
}

public void testIsDuplicateString ( ) { int count = 10000 ; ActiveMQMessageAudit audit = new ActiveMQMessageAudit ( ) ; IdGenerator idGen = new IdGenerator ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < count ; i ++ ) { String id = idGen . generateId ( ) ; list . add ( id ) ; assertFalse ( audit . isDuplicate ( id ) ) ; } List < String > windowList = list . subList ( list . size ( ) - 1 - audit . getAuditDepth ( ) , list . size ( ) - 1 ) ; for ( String id : windowList ) { assertTrue ( "duplicate, id:" + id , audit . isDuplicate ( id ) ) ; } }
test case for isduplicate
