@Test public void getOrCreateStudyEmptyStudySource() throws NodeFactoryException { NodeFactory factory = Mockito.mock(NodeFactory.class); Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream); NodeFactoryWithDatasetContext factoryWithDS = new NodeFactoryWithDatasetContext(factory, dataset); factoryWithDS.getOrCreateStudy(new StudyImpl("some title")); ArgumentCaptor<Study> argument = ArgumentCaptor.forClass(Study.class); verify(factory).getOrCreateStudy(argument.capture()); assertEquals("some title", argument.getValue().getTitle()); }
@Override public Study getOrCreateStudy(Study study) throws NodeFactoryException { return factory.getOrCreateStudy(studyForDataset(study)); }
NodeFactoryWithDatasetContext implements NodeFactory { @Override public Study getOrCreateStudy(Study study) throws NodeFactoryException { return factory.getOrCreateStudy(studyForDataset(study)); } }
NodeFactoryWithDatasetContext implements NodeFactory { @Override public Study getOrCreateStudy(Study study) throws NodeFactoryException { return factory.getOrCreateStudy(studyForDataset(study)); } NodeFactoryWithDatasetContext(NodeFactory factory, Dataset dataset); }
NodeFactoryWithDatasetContext implements NodeFactory { @Override public Study getOrCreateStudy(Study study) throws NodeFactoryException { return factory.getOrCreateStudy(studyForDataset(study)); } NodeFactoryWithDatasetContext(NodeFactory factory, Dataset dataset); @Override Location findLocation(Location location); @Override Season createSeason(String seasonNameLower); @Override Specimen createSpecimen(Interaction interaction, Taxon taxon); @Override Specimen createSpecimen(Study study, Taxon taxon); @Override Specimen createSpecimen(Study study, Taxon taxon, RelTypes... relTypes); @Override Study createStudy(Study study); @Override Study getOrCreateStudy(Study study); @Override Study findStudy(String title); @Override Season findSeason(String seasonName); @Override Location getOrCreateLocation(Location location); @Override void setUnixEpochProperty(Specimen specimen, Date date); @Override Date getUnixEpochProperty(Specimen specimen); @Override List<Environment> getOrCreateEnvironments(Location location, String externalId, String name); @Override List<Environment> addEnvironmentToLocation(Location location, List<Term> terms); @Override Term getOrCreateBodyPart(String externalId, String name); @Override Term getOrCreatePhysiologicalState(String externalId, String name); @Override Term getOrCreateLifeStage(String externalId, String name); @Override TermLookupService getTermLookupService(); @Override AuthorIdResolver getAuthorResolver(); @Override Term getOrCreateBasisOfRecord(String externalId, String name); @Override Dataset getOrCreateDataset(Dataset dataset); @Override Interaction createInteraction(Study study); Dataset getDataset(); }
NodeFactoryWithDatasetContext implements NodeFactory { @Override public Study getOrCreateStudy(Study study) throws NodeFactoryException { return factory.getOrCreateStudy(studyForDataset(study)); } NodeFactoryWithDatasetContext(NodeFactory factory, Dataset dataset); @Override Location findLocation(Location location); @Override Season createSeason(String seasonNameLower); @Override Specimen createSpecimen(Interaction interaction, Taxon taxon); @Override Specimen createSpecimen(Study study, Taxon taxon); @Override Specimen createSpecimen(Study study, Taxon taxon, RelTypes... relTypes); @Override Study createStudy(Study study); @Override Study getOrCreateStudy(Study study); @Override Study findStudy(String title); @Override Season findSeason(String seasonName); @Override Location getOrCreateLocation(Location location); @Override void setUnixEpochProperty(Specimen specimen, Date date); @Override Date getUnixEpochProperty(Specimen specimen); @Override List<Environment> getOrCreateEnvironments(Location location, String externalId, String name); @Override List<Environment> addEnvironmentToLocation(Location location, List<Term> terms); @Override Term getOrCreateBodyPart(String externalId, String name); @Override Term getOrCreatePhysiologicalState(String externalId, String name); @Override Term getOrCreateLifeStage(String externalId, String name); @Override TermLookupService getTermLookupService(); @Override AuthorIdResolver getAuthorResolver(); @Override Term getOrCreateBasisOfRecord(String externalId, String name); @Override Dataset getOrCreateDataset(Dataset dataset); @Override Interaction createInteraction(Study study); Dataset getDataset();  }