DocumentToDocumentClassesActionBuilderModuleFactory extends AbstractActionBuilderFactory<DocumentToDocumentClasses, Result> { @Override public ActionBuilderModule<DocumentToDocumentClasses, Result> instantiate(Configuration config) { return new DocumentToDocumentClassesActionBuilderModule(provideTrustLevelThreshold(config)); } DocumentToDocumentClassesActionBuilderModuleFactory(); @Override ActionBuilderModule<DocumentToDocumentClasses, Result> instantiate(Configuration config);  }
@Test public void testBuildEmptyClasses() throws Exception { String docId = "documentId"; ActionBuilderModule<DocumentToDocumentClasses, Result> module = factory.instantiate(config); List<AtomicAction<Result>> actions = module.build(DocumentToDocumentClasses.newBuilder().setDocumentId(docId).build()); assertNotNull(actions); assertEquals(0, actions.size()); }
@Test public void testBuildBelowThreshold() throws Exception { String docId = "docId"; float confidenceLevel = 0.4f; ActionBuilderModule<DocumentToDocumentClasses, Result> module = factory.instantiate(config); List<AtomicAction<Result>> actions = module.build(buildDocumentToDocumentClasses(docId, confidenceLevel)); assertNotNull(actions); assertEquals(0, actions.size()); }
@Test public void testBuild() throws Exception { String docId = "docId"; float confidenceLevel = 0.6f; ActionBuilderModule<DocumentToDocumentClasses, Result> module = factory.instantiate(config); List<AtomicAction<Result>> actions = module.build(buildDocumentToDocumentClasses(docId, confidenceLevel)); assertNotNull(actions); assertEquals(1, actions.size()); AtomicAction<Result> action = actions.get(0); assertNotNull(action); assertEquals(Result.class, action.getClazz()); assertOaf(action.getPayload(), docId, confidenceLevel); }