@Test public void testCopyGatheringEvent() { OffsetDateTime time = OffsetDateTime.parse("2011-12-03T10:15:30Z"); Organization org = new Organization(); org.setName("Naturalis"); List<Organization> gatheringOrganizations = new ArrayList<>(); gatheringOrganizations.add(org); Person person = new Person(); person.setFullName("Plabon Kakoti"); person.setOrganization(org); person.setAgentText("test"); List<Person> gatheringPersons = new ArrayList<>(); gatheringPersons.add(person); GatheringSiteCoordinates siteCoordinates = new GatheringSiteCoordinates(); siteCoordinates.setLongitudeDecimal(5.016667); siteCoordinates.setLatitudeDecimal(51.433333); List<GatheringSiteCoordinates> coordinates = new ArrayList<>(); coordinates.add(siteCoordinates); GatheringEvent gatheringEvent = new GatheringEvent(); gatheringEvent.setDateTimeBegin(time); gatheringEvent.setGatheringOrganizations(gatheringOrganizations); gatheringEvent.setGatheringPersons(gatheringPersons); gatheringEvent.setLocality("Amsterdam"); gatheringEvent.setSiteCoordinates(coordinates); Object obj = ReflectionUtil.callStatic(SummaryObjectUtil.class, "copyGatheringEvent", new Class[] {GatheringEvent.class}, new Object[] {gatheringEvent}); SummaryGatheringEvent actual = (SummaryGatheringEvent) obj; assertNotNull("01", actual); assertEquals("02", "2011-12-03T10:15:30Z", actual.getDateTimeBegin().toString()); assertEquals("03", "Plabon Kakoti", actual.getGatheringPersons().get(0).getFullName()); assertEquals("04", "Naturalis", actual.getGatheringOrganizations().get(0).getName()); }
private static SummaryGatheringEvent copyGatheringEvent(GatheringEvent ge) { if (ge == null) { return null; } SummaryGatheringEvent summary = new SummaryGatheringEvent(); summary.setDateTimeBegin(ge.getDateTimeBegin()); summary.setGatheringOrganizations(copyOrganizations(ge.getGatheringOrganizations())); summary.setGatheringPersons(copyPersons(ge.getGatheringPersons())); summary.setLocalityText(ge.getLocalityText()); summary.setSiteCoordinates(copySiteCoordinates(ge.getSiteCoordinates())); return summary; }
SummaryObjectUtil { private static SummaryGatheringEvent copyGatheringEvent(GatheringEvent ge) { if (ge == null) { return null; } SummaryGatheringEvent summary = new SummaryGatheringEvent(); summary.setDateTimeBegin(ge.getDateTimeBegin()); summary.setGatheringOrganizations(copyOrganizations(ge.getGatheringOrganizations())); summary.setGatheringPersons(copyPersons(ge.getGatheringPersons())); summary.setLocalityText(ge.getLocalityText()); summary.setSiteCoordinates(copySiteCoordinates(ge.getSiteCoordinates())); return summary; } }
SummaryObjectUtil { private static SummaryGatheringEvent copyGatheringEvent(GatheringEvent ge) { if (ge == null) { return null; } SummaryGatheringEvent summary = new SummaryGatheringEvent(); summary.setDateTimeBegin(ge.getDateTimeBegin()); summary.setGatheringOrganizations(copyOrganizations(ge.getGatheringOrganizations())); summary.setGatheringPersons(copyPersons(ge.getGatheringPersons())); summary.setLocalityText(ge.getLocalityText()); summary.setSiteCoordinates(copySiteCoordinates(ge.getSiteCoordinates())); return summary; } private  SummaryObjectUtil(); }
SummaryObjectUtil { private static SummaryGatheringEvent copyGatheringEvent(GatheringEvent ge) { if (ge == null) { return null; } SummaryGatheringEvent summary = new SummaryGatheringEvent(); summary.setDateTimeBegin(ge.getDateTimeBegin()); summary.setGatheringOrganizations(copyOrganizations(ge.getGatheringOrganizations())); summary.setGatheringPersons(copyPersons(ge.getGatheringPersons())); summary.setLocalityText(ge.getLocalityText()); summary.setSiteCoordinates(copySiteCoordinates(ge.getSiteCoordinates())); return summary; } private  SummaryObjectUtil(); static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup); static SummaryTaxon copyTaxon(Taxon taxon); static SummaryScientificName copyScientificName(ScientificName sn); static SummaryVernacularName copySummaryVernacularName(VernacularName vn); static SummarySourceSystem copySourceSystem(SourceSystem ss); }
SummaryObjectUtil { private static SummaryGatheringEvent copyGatheringEvent(GatheringEvent ge) { if (ge == null) { return null; } SummaryGatheringEvent summary = new SummaryGatheringEvent(); summary.setDateTimeBegin(ge.getDateTimeBegin()); summary.setGatheringOrganizations(copyOrganizations(ge.getGatheringOrganizations())); summary.setGatheringPersons(copyPersons(ge.getGatheringPersons())); summary.setLocalityText(ge.getLocalityText()); summary.setSiteCoordinates(copySiteCoordinates(ge.getSiteCoordinates())); return summary; } private  SummaryObjectUtil(); static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup); static SummaryTaxon copyTaxon(Taxon taxon); static SummaryScientificName copyScientificName(ScientificName sn); static SummaryVernacularName copySummaryVernacularName(VernacularName vn); static SummarySourceSystem copySourceSystem(SourceSystem ss);  }