DocumentToDataSetActionBuilderModuleFactory extends AbstractActionBuilderFactory<DocumentToDataSet, Relation> { @Override public ActionBuilderModule<DocumentToDataSet, Relation> instantiate(Configuration config) { return new DocumentToDataSetActionBuilderModule(provideTrustLevelThreshold(config)); } DocumentToDataSetActionBuilderModuleFactory(); @Override ActionBuilderModule<DocumentToDataSet, Relation> instantiate(Configuration config);  }
@Test(expected = TrustLevelThresholdExceededException.class) public void testBuildBelowThreshold() throws Exception { DocumentToDataSet documentToDataset = buildDocumentToDataset("documentId", "datasetId", 0.4f); ActionBuilderModule<DocumentToDataSet, Relation> module = factory.instantiate(config); module.build(documentToDataset); }
@Test public void testBuild() throws Exception { String docId = "documentId"; String datasetId = "datasetId"; float matchStrength = 0.9f; ActionBuilderModule<DocumentToDataSet, Relation> module = factory.instantiate(config); List<AtomicAction<Relation>> actions = module.build(buildDocumentToDataset(docId, datasetId, 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, datasetId, matchStrength, "resultResult", "publicationDataset", "isRelatedTo"); assertOafRel(action.getPayload(), expectations); action = actions.get(1); assertNotNull(action); assertEquals(Relation.class, action.getClazz()); expectations.setSource(datasetId); expectations.setTarget(docId); assertOafRel(action.getPayload(), expectations); }