public void verifyNotificationCounter(Notification notification,String status,Long timestamp, int expected){
Results countersResults = app.getEntityManager().getAggregateCounters( null,null,null,"counters.notifications."+notification.getUuid()+"."+status,
CounterResolution.ALL,timestamp,System.currentTimeMillis(),false ) ;
assertEquals( 1, countersResults.getCounters().size() );
if(expected > 0) {
assertEquals( expected, countersResults.getCounters().get( 0 ).getValues().get( 0 ).getValue() );
}else if (expected == 0){
assertEquals( 0,countersResults.getCounters().get( 0 ).getValues().size());
}
LocalDateTime localDateTime = LocalDateTime.now();
StringBuilder currentDate = new StringBuilder( );
currentDate.append( "counters.notifications.aggregate."+status+"." );
currentDate.append( localDateTime.getYear()+"." );
currentDate.append( localDateTime.getMonth()+"." );
currentDate.append( localDateTime.getDayOfMonth());
countersResults = app.getEntityManager().getAggregateCounters( null,null,null,currentDate.toString(),
CounterResolution.ALL,timestamp,System.currentTimeMillis(),false ) ;
assertEquals( 1, countersResults.getCounters().size() );
if(expected > 0) {
assertEquals( expected, countersResults.getCounters().get( 0 ).getValues().get( 0 ).getValue() );
}
else if (expected == 0){
assertEquals( 0,countersResults.getCounters().get( 0 ).getValues().size());
}
}