@Test public void generateReport() throws Exception { when(matchedDocOrganizations.count()).thenReturn(199L); doReturn(docIds).when(matchedDocOrganizations).map(Mockito.any()); when(docIds.distinct()).thenReturn(distinctDocIds); when(distinctDocIds.count()).thenReturn(88L); List<ReportEntry> reportEntries = reportGenerator.generateReport(matchedDocOrganizations); assertThat(reportEntries, containsInAnyOrder(createCounterReportEntry(DOC_ORG_REFERENCES, 199), createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, 88))); verify(matchedDocOrganizations).map(mapToDocIdFunction.capture()); assertMapToDocIdFunction(mapToDocIdFunction.getValue()); }
public List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations) { Preconditions.checkNotNull(matchedDocOrganizations); List<ReportEntry> reportEntries = Lists.newArrayList(); long docOrgReferenceCount = matchedDocOrganizations.count(); reportEntries.add(createCounterReportEntry(DOC_ORG_REFERENCES, docOrgReferenceCount)); long docWithAtLeastOneOrgCount = matchedDocOrganizations.map(v->v.getDocumentId()).distinct().count(); reportEntries.add(createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, docWithAtLeastOneOrgCount)); return reportEntries; }
AffMatchReportGenerator implements Serializable { public List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations) { Preconditions.checkNotNull(matchedDocOrganizations); List<ReportEntry> reportEntries = Lists.newArrayList(); long docOrgReferenceCount = matchedDocOrganizations.count(); reportEntries.add(createCounterReportEntry(DOC_ORG_REFERENCES, docOrgReferenceCount)); long docWithAtLeastOneOrgCount = matchedDocOrganizations.map(v->v.getDocumentId()).distinct().count(); reportEntries.add(createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, docWithAtLeastOneOrgCount)); return reportEntries; } }
AffMatchReportGenerator implements Serializable { public List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations) { Preconditions.checkNotNull(matchedDocOrganizations); List<ReportEntry> reportEntries = Lists.newArrayList(); long docOrgReferenceCount = matchedDocOrganizations.count(); reportEntries.add(createCounterReportEntry(DOC_ORG_REFERENCES, docOrgReferenceCount)); long docWithAtLeastOneOrgCount = matchedDocOrganizations.map(v->v.getDocumentId()).distinct().count(); reportEntries.add(createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, docWithAtLeastOneOrgCount)); return reportEntries; }  }
AffMatchReportGenerator implements Serializable { public List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations) { Preconditions.checkNotNull(matchedDocOrganizations); List<ReportEntry> reportEntries = Lists.newArrayList(); long docOrgReferenceCount = matchedDocOrganizations.count(); reportEntries.add(createCounterReportEntry(DOC_ORG_REFERENCES, docOrgReferenceCount)); long docWithAtLeastOneOrgCount = matchedDocOrganizations.map(v->v.getDocumentId()).distinct().count(); reportEntries.add(createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, docWithAtLeastOneOrgCount)); return reportEntries; }  List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations); }
AffMatchReportGenerator implements Serializable { public List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations) { Preconditions.checkNotNull(matchedDocOrganizations); List<ReportEntry> reportEntries = Lists.newArrayList(); long docOrgReferenceCount = matchedDocOrganizations.count(); reportEntries.add(createCounterReportEntry(DOC_ORG_REFERENCES, docOrgReferenceCount)); long docWithAtLeastOneOrgCount = matchedDocOrganizations.map(v->v.getDocumentId()).distinct().count(); reportEntries.add(createCounterReportEntry(DOCS_WITH_AT_LEAST_ONE_ORG, docWithAtLeastOneOrgCount)); return reportEntries; }  List<ReportEntry> generateReport(JavaRDD<MatchedOrganization> matchedDocOrganizations);  }