Summary { public String build() { if (taxon.isAccepted() || taxon.getTaxonomicStatus() == TaxonomicStatus.Artificial_Hybrid) { return createAcceptedNameSummary(); } if (taxon.isSynonym() || taxon.getTaxonomicStatus() == TaxonomicStatus.Misapplied) { return createSynonymNameSummary(); } if (TaxonomicStatus.Unplaced.equals(taxon.getTaxonomicStatus())) { return createUnplacedNameSummary(); } return ""; } Summary(Taxon taxon, MessageSource messageSource); String taxonStatus(); String build();  }
@Test public void taxonAcceptedSummary() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); assertEquals("This plant is accepted.", new Summary(tax, messageSource).build()); }
@Test public void taxonSynonoymSummary() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Synonym); assertEquals("This is a synonym", new Summary(tax, messageSource).build()); }
@Test public void taxonArtificialHybridSummary() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Artificial_Hybrid); assertEquals("This plant is an artifical hybrid.", new Summary(tax, messageSource).build()); }
@Test public void taxonUnplacedSummary() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Unplaced); assertEquals("This is an unplaced name.", new Summary(tax, messageSource).build()); }
@Test public void taxonAcceptedSummaryWithDistribution() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); tax.setDistribution(oneDistribution); System.out.println(new Summary(tax, messageSource).build()); tax.setDistribution(manyDistributions()); System.out.println(new Summary(tax, messageSource).build()); }
@Test public void taxonAcceptedSummaryWithUses() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); System.out.println(new Summary(tax, messageSource).build()); }
@Test public void taxonAcceptedSummaryWithGeographicArea() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); System.out.println(new Summary(tax, messageSource).build()); }
@Test public void taxonAcceptedSummaryWithGeographicAreaDistributionAndUses() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); System.out.println(new Summary(tax, messageSource).build()); }
@Test public void taxonWCSDistribution() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); tax.setTaxonRemarks("Andaman Is., Thailand to W. Malesia."); assertEquals("This plant is accepted, and its native range is Andaman Islands, Thailand to W. Malesia.", new Summary(tax, messageSource).build()); }
@Test public void taxonWCSUncertainDistribution() { Taxon tax = new Taxon(); tax.setTaxonomicStatus(TaxonomicStatus.Accepted); tax.setTaxonRemarks("(Guatamala) ? (?)"); assertEquals("This plant is accepted, and its native range is likely to be (Guatamala) ?.", new Summary(tax, messageSource).build()); }