DocumentToProjectActionBuilderModuleFactory extends AbstractActionBuilderFactory<DocumentToProject, Relation> { @Override public ActionBuilderModule<DocumentToProject, Relation> instantiate(Configuration config) { return new DocumentToProjectActionBuilderModule(provideTrustLevelThreshold(config)); } DocumentToProjectActionBuilderModuleFactory(); @Override ActionBuilderModule<DocumentToProject, Relation> instantiate(Configuration config);  }
@Test(expected = TrustLevelThresholdExceededException.class) public void testBuildBelowThreshold() throws Exception { DocumentToProject documentToProject = buildDocumentToProject("documentId", "projectId", 0.4f); ActionBuilderModule<DocumentToProject, Relation> module = factory.instantiate(config); module.build(documentToProject); }
@Test public void testBuild() throws Exception { String docId = "documentId"; String projectId = "projectId"; float matchStrength = 0.9f; ActionBuilderModule<DocumentToProject, Relation> module = factory.instantiate(config); List<AtomicAction<Relation>> actions = module.build(buildDocumentToProject(docId, projectId, matchStrength)); assertNotNull(actions); assertEquals(2, actions.size()); AtomicAction<Relation> action = actions.get(0); assertNotNull(action); assertEquals(Relation.class, action.getClazz()); Expectations expectations = new Expectations(docId, projectId, matchStrength, "resultProject", "outcome", "isProducedBy"); assertOafRel(action.getPayload(), expectations); action = actions.get(1); assertNotNull(action); assertEquals(Relation.class, action.getClazz()); expectations.setSource(projectId); expectations.setTarget(docId); expectations.setRelationClass("produces"); assertOafRel(action.getPayload(), expectations); }