CoreCitationMatchingSimpleFactory { public CoreCitationMatchingService createCoreCitationMatchingService(JavaSparkContext sc, long maxHashBucketSize) { CoreCitationMatchingService coreCitationMatchingService = new CoreCitationMatchingService(); coreCitationMatchingService.setSparkContext(sc); coreCitationMatchingService.setMaxHashBucketSize(maxHashBucketSize); coreCitationMatchingService.setMatchableEntityHashers(createMatchableEntityHashers()); return coreCitationMatchingService; }  CoreCitationMatchingService createCoreCitationMatchingService(JavaSparkContext sc, long maxHashBucketSize);  }
@Test public void createCoreCitationMatchingService() { JavaSparkContext sparkContext = mock(JavaSparkContext.class); CoreCitationMatchingService citationMatchingService = coreCitationMatchingFactory.createCoreCitationMatchingService(sparkContext, 1000); Object retSparkContext = Whitebox.getInternalState(citationMatchingService, "sparkContext"); assertTrue(retSparkContext == sparkContext); Object retMaxHashBucketSize = Whitebox.getInternalState(citationMatchingService, "maxHashBucketSize"); assertEquals(retMaxHashBucketSize, 1000l); @SuppressWarnings("unchecked") List<Pair<MatchableEntityHasher, MatchableEntityHasher>> retHashers = (List<Pair<MatchableEntityHasher, MatchableEntityHasher>>) Whitebox.getInternalState(citationMatchingService, "matchableEntityHashers"); assertEquals(retHashers.size(), 4); assertHashersPair(retHashers.get(0), CitationNameYearPagesHashGenerator.class, DocumentNameYearPagesHashGenerator.class); assertHashersPair(retHashers.get(1), CitationNameYearPagesHashGenerator.class, DocumentNameYearNumNumHashGenerator.class); assertHashersPair(retHashers.get(2), CitationNameYearHashGenerator.class, DocumentNameYearStrictHashGenerator.class); assertHashersPair(retHashers.get(3), CitationNameYearHashGenerator.class, DocumentNameYearHashGenerator.class); Object retDocumentAttacher = Whitebox.getInternalState(citationMatchingService, "documentAttacher"); assertNotNull(retDocumentAttacher); Object retCitationAttacher = Whitebox.getInternalState(citationMatchingService, "citationAttacher"); assertNotNull(retCitationAttacher); Object retBestPicker = Whitebox.getInternalState(citationMatchingService, "bestMatchedCitationPicker"); assertNotNull(retBestPicker); Object retHashCitationMatcherFactory = Whitebox.getInternalState(citationMatchingService, "heuristicHashCitationMatcherFactory"); assertNotNull(retHashCitationMatcherFactory); }