AbstractDocumentToConceptsActionBuilderModuleFactory extends AbstractActionBuilderFactory<DocumentToConceptIds, Result> { @Override public ActionBuilderModule<DocumentToConceptIds, Result> instantiate(Configuration config) { return new DocumentToConceptsActionBuilderModule(provideTrustLevelThreshold(config)); } AbstractDocumentToConceptsActionBuilderModuleFactory(AlgorithmName algorithmName); @Override ActionBuilderModule<DocumentToConceptIds, Result> instantiate(Configuration config);  }
@Test public void testBuildEmptyConcepts() throws Exception { String docId = "documentId"; ActionBuilderModule<DocumentToConceptIds, Result> module = factory.instantiate(config); List<AtomicAction<Result>> actions = module.build( DocumentToConceptIds.newBuilder().setConcepts(Collections.emptyList()).setDocumentId(docId).build()); assertNotNull(actions); assertEquals(0, actions.size()); }
@Test public void testBuild() throws Exception { String docId = "documentId"; String conceptId = "conceptId"; float confidenceLevel = 1f; ActionBuilderModule<DocumentToConceptIds, Result> module = factory.instantiate(config); List<AtomicAction<Result>> actions = module.build(buildDocumentToConceptIds(docId, conceptId, confidenceLevel)); assertNotNull(actions); assertEquals(1, actions.size()); AtomicAction<Result> action = actions.get(0); assertNotNull(action); assertEquals(Result.class, action.getClazz()); assertOaf(action.getPayload(), docId, conceptId, confidenceLevel); }