@Test void aggregateNoThreshold() throws Exception { when(appSettings.getAggregateThreshold()).thenReturn(null); AggregateQuery aggregateQuery = mock(AggregateQuery.class); AggregateResult aggregateResult = mock(AggregateResult.class); when(delegateRepository.aggregate(aggregateQuery)).thenReturn(aggregateResult); assertEquals(aggregateAnonymizerRepoDecorator.aggregate(aggregateQuery), aggregateResult); verifyZeroInteractions(aggregateAnonymizer); verifyZeroInteractions(aggregateResult); }
@Override public AggregateResult aggregate(AggregateQuery aggregateQuery) { AggregateResult result = delegate().aggregate(aggregateQuery); Integer threshold = appSettings.getAggregateThreshold(); if (threshold != null && threshold > 0) { result = aggregateAnonymizer.anonymize(result, threshold); } return result; }
AggregateAnonymizerRepositoryDecorator extends AbstractRepositoryDecorator<E> { @Override public AggregateResult aggregate(AggregateQuery aggregateQuery) { AggregateResult result = delegate().aggregate(aggregateQuery); Integer threshold = appSettings.getAggregateThreshold(); if (threshold != null && threshold > 0) { result = aggregateAnonymizer.anonymize(result, threshold); } return result; } }
AggregateAnonymizerRepositoryDecorator extends AbstractRepositoryDecorator<E> { @Override public AggregateResult aggregate(AggregateQuery aggregateQuery) { AggregateResult result = delegate().aggregate(aggregateQuery); Integer threshold = appSettings.getAggregateThreshold(); if (threshold != null && threshold > 0) { result = aggregateAnonymizer.anonymize(result, threshold); } return result; } AggregateAnonymizerRepositoryDecorator(
      Repository<E> delegateRepository,
      AggregateAnonymizer aggregateAnonymizer,
      AppSettings appSettings); }
AggregateAnonymizerRepositoryDecorator extends AbstractRepositoryDecorator<E> { @Override public AggregateResult aggregate(AggregateQuery aggregateQuery) { AggregateResult result = delegate().aggregate(aggregateQuery); Integer threshold = appSettings.getAggregateThreshold(); if (threshold != null && threshold > 0) { result = aggregateAnonymizer.anonymize(result, threshold); } return result; } AggregateAnonymizerRepositoryDecorator(
      Repository<E> delegateRepository,
      AggregateAnonymizer aggregateAnonymizer,
      AppSettings appSettings); @Override AggregateResult aggregate(AggregateQuery aggregateQuery); }
AggregateAnonymizerRepositoryDecorator extends AbstractRepositoryDecorator<E> { @Override public AggregateResult aggregate(AggregateQuery aggregateQuery) { AggregateResult result = delegate().aggregate(aggregateQuery); Integer threshold = appSettings.getAggregateThreshold(); if (threshold != null && threshold > 0) { result = aggregateAnonymizer.anonymize(result, threshold); } return result; } AggregateAnonymizerRepositoryDecorator(
      Repository<E> delegateRepository,
      AggregateAnonymizer aggregateAnonymizer,
      AppSettings appSettings); @Override AggregateResult aggregate(AggregateQuery aggregateQuery);  }