@Test public void testSynonymDescriptions() { Description d2 = new Description(); Taxon synonym = new Taxon(); synonym.setScientificName("Eucalypton"); synonym.setTaxonomicStatus(TaxonomicStatus.Synonym); d1.setType(DescriptionType.morphologyGeneral); d1.setDescription("accepted description"); d2.setAuthority(o1); d2.setType(DescriptionType.morphologyGeneralHabit); d2.setDescription("synonym description"); synonym.setDescriptions(ImmutableSet.<Description>of(d2)); taxon.setDescriptions(ImmutableSet.<Description>of(d1)); taxon.setSynonymNameUsages(ImmutableSet.<Taxon>of(synonym)); Descriptions ds = new Descriptions(taxon); for(DescriptionsBySource dbs : ds.getBySource()) { if(dbs.asTaxon.getScientificName().equals("Eucalypton")) { assertEquals(d2, dbs.byType.get(0).descriptions.get(0)); } else { assertEquals(d1, dbs.byType.get(0).descriptions.get(0)); } } }
public Collection<DescriptionsBySource> getBySource() { if(descriptionsBySource == null) { descriptionsBySource = new ArrayList<>(); if(taxon.looksAccepted()) { partitionBySource(taxon); for(Taxon synonym : taxon.getSynonymNameUsages()) { partitionBySource(synonym); } Collections.sort(descriptionsBySource); } } return descriptionsBySource; }
Descriptions { public Collection<DescriptionsBySource> getBySource() { if(descriptionsBySource == null) { descriptionsBySource = new ArrayList<>(); if(taxon.looksAccepted()) { partitionBySource(taxon); for(Taxon synonym : taxon.getSynonymNameUsages()) { partitionBySource(synonym); } Collections.sort(descriptionsBySource); } } return descriptionsBySource; } }
Descriptions { public Collection<DescriptionsBySource> getBySource() { if(descriptionsBySource == null) { descriptionsBySource = new ArrayList<>(); if(taxon.looksAccepted()) { partitionBySource(taxon); for(Taxon synonym : taxon.getSynonymNameUsages()) { partitionBySource(synonym); } Collections.sort(descriptionsBySource); } } return descriptionsBySource; } Descriptions(Taxon taxon);  Descriptions(Taxon taxon, boolean isUses); }
Descriptions { public Collection<DescriptionsBySource> getBySource() { if(descriptionsBySource == null) { descriptionsBySource = new ArrayList<>(); if(taxon.looksAccepted()) { partitionBySource(taxon); for(Taxon synonym : taxon.getSynonymNameUsages()) { partitionBySource(synonym); } Collections.sort(descriptionsBySource); } } return descriptionsBySource; } Descriptions(Taxon taxon);  Descriptions(Taxon taxon, boolean isUses); @JsonSerialize(contentUsing = BaseSerializer.class) List<Taxon> getSynonymsIncluded(); Collection<DescriptionsBySource> getBySource(); }
Descriptions { public Collection<DescriptionsBySource> getBySource() { if(descriptionsBySource == null) { descriptionsBySource = new ArrayList<>(); if(taxon.looksAccepted()) { partitionBySource(taxon); for(Taxon synonym : taxon.getSynonymNameUsages()) { partitionBySource(synonym); } Collections.sort(descriptionsBySource); } } return descriptionsBySource; } Descriptions(Taxon taxon);  Descriptions(Taxon taxon, boolean isUses); @JsonSerialize(contentUsing = BaseSerializer.class) List<Taxon> getSynonymsIncluded(); Collection<DescriptionsBySource> getBySource();  }