CollectionPerformanceResult implements Serializable { public AveragedPerformanceMeasures getAveragedPerformanceMeasures(int retrievedCount) { return new AveragedPerformanceMeasures(getDocumentPerformanceMeasures(retrievedCount)); } CollectionPerformanceResult(List<DocumentPerformanceResult> documentEvaluationResults); AveragedPerformanceMeasures getAveragedPerformanceMeasures(int retrievedCount); AveragedPerformanceMeasures getAveragedPerformanceMeasures(double retrievedPercentage); AveragedPerformanceMeasures getAveragedPerformanceMeasures(); List<DocumentPerformanceResult> getDocumentPerformanceResults(); List<PerformanceMeasures> getDocumentPerformanceMeasures(int retrievedCount); List<PerformanceMeasures> getDocumentPerformanceMeasures(double retrievedPercentage); List<PerformanceMeasures> getDocumentPerformanceMeasures(); int getDocumentCount(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void instantiationAndCalculation_OneDocument() { DocumentPerformanceResult dpr1 = new DocumentPerformanceResult("d1", list( 1, 1, 1, 1), 4); CollectionPerformanceResult collectionPerformanceResult = new CollectionPerformanceResult( list(dpr1)); AveragedPerformanceMeasures actualByRetrievedCount = collectionPerformanceResult .getAveragedPerformanceMeasures(2); AveragedPerformanceMeasures actualByRetrievedPercentage = collectionPerformanceResult .getAveragedPerformanceMeasures(0.5D); PerformanceMeasures pm1 = new PerformanceMeasures(2, 2, 4); AveragedPerformanceMeasures expected = new AveragedPerformanceMeasures( list(pm1)); assertEquals(expected, actualByRetrievedCount); assertEquals(expected, actualByRetrievedPercentage); }
@Test public void instantiationAndCalculation_TwoDocuments() { DocumentPerformanceResult dpr1 = new DocumentPerformanceResult("d1", list( 1, 1, 1, 1), 4); DocumentPerformanceResult dpr2 = new DocumentPerformanceResult("d2", list( 1, 0), 2); CollectionPerformanceResult collectionPerformanceResult = new CollectionPerformanceResult( list(dpr1, dpr2)); AveragedPerformanceMeasures actualByRetrievedCount = collectionPerformanceResult .getAveragedPerformanceMeasures(2); AveragedPerformanceMeasures actualByRetrievedPercentage = collectionPerformanceResult .getAveragedPerformanceMeasures(0.5D); PerformanceMeasures pm1 = new PerformanceMeasures(2, 2, 4); PerformanceMeasures pm2ByCount = new PerformanceMeasures(2, 1, 2); PerformanceMeasures pm2ByPercentage = new PerformanceMeasures(1, 1, 2); AveragedPerformanceMeasures expectedByRetrievedCount = new AveragedPerformanceMeasures( list(pm1, pm2ByCount)); AveragedPerformanceMeasures expectedByRetrievedPercentage = new AveragedPerformanceMeasures( list(pm1, pm2ByPercentage)); assertEquals(expectedByRetrievedCount, actualByRetrievedCount); assertEquals(expectedByRetrievedPercentage, actualByRetrievedPercentage); }