commit d3548cc6de12d80ebc8c206d25059e8c75b634ca
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Fri Sep 16 12:31:55 2011 +0000

    regression test for #2561 (allow supressing display of specific annotations)

diff --git a/.gitattributes b/.gitattributes
index f0645558..25882ed7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -257,6 +257,7 @@ modules/cdm_dataportal/test/java/dataportal-selenium-tests/pom.xml -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/Browser.java -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalContext.java -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/DataPortalManager.java -text
+modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/SystemUtils.java -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/TestConfiguration.java -text
 modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/TestConfigurationException.java -text
diff --git a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java
new file mode 100644
index 00000000..45131501
--- /dev/null
+++ b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/ElementUtils.java
@@ -0,0 +1,52 @@
+// $Id$
+/**
+* Copyright (C) 2011 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.dataportal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import eu.etaxonomy.dataportal.elements.BaseElement;
+import eu.etaxonomy.dataportal.elements.LinkElement;
+
+/**
+ * @author andreas
+ * @date Sep 16, 2011
+ *
+ */
+public class ElementUtils {
+
+	/**
+	 * @param fnListElements
+	 * @return
+	 */
+	public static List<BaseElement> baseElementsFromFootNoteListElements(List<WebElement> fnListElements) {
+		List<BaseElement> footNotes = new ArrayList<BaseElement>();
+		for(WebElement fn : fnListElements) {
+			footNotes.add(new BaseElement(fn));
+		}
+		return footNotes;
+	}
+
+	/**
+	 * @param fnkListElements
+	 * @return
+	 */
+	public static List<LinkElement> linkElementsFromFootNoteKeyListElements(List<WebElement> fnkListElements) {
+		List<LinkElement> footNoteKeys = new ArrayList<LinkElement>();
+		for(WebElement fnk : fnkListElements) {
+			footNoteKeys.add(new LinkElement(fnk));
+		}
+		return footNoteKeys;
+	}
+
+}
diff --git a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
index 174579e7..8e067206 100644
--- a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
+++ b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/pages/TaxonSynonymyPage.java
@@ -28,6 +28,8 @@ import org.openqa.selenium.support.CacheLookup;
 import org.openqa.selenium.support.FindBy;
 
 import eu.etaxonomy.dataportal.DataPortalContext;
+import eu.etaxonomy.dataportal.ElementUtils;
+import eu.etaxonomy.dataportal.elements.BaseElement;
 import eu.etaxonomy.dataportal.elements.FeatureBlock;
 import eu.etaxonomy.dataportal.elements.ImgElement;
 import eu.etaxonomy.dataportal.elements.LinkElement;
@@ -93,10 +95,19 @@ public class TaxonSynonymyPage extends PortalPage {
 	 * @return The Url of the profile image or null if the image is not visible.
 	 */
 	public String getAcceptedName() {
-		WebElement acceptedName = synonymy.findElement(By.xpath("./span[contains(@class,'accepted-name')]"));
+		WebElement acceptedName = synonymy.findElement(
+				By.xpath("./span[contains(@class,'accepted-name')]")
+		);
 		return acceptedName.getText();
 	}
 
+	public List<LinkElement> getAcceptedNameFootNoteKeys() {
+		List<WebElement> fnkListElements = synonymy.findElements(
+				By.xpath("./span[contains(@class,'accepted-name')]/following-sibling::span[contains(@class, 'footnote-key')]/a")
+		);
+		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
+	}
+
 	/**
 	 * @param synonymIndex
 	 *            the 1-based position of the synonym in the list of homotypical
@@ -105,11 +116,30 @@ public class TaxonSynonymyPage extends PortalPage {
 	 *         and all information rendered after the name. All whitespace is
 	 *         normalized to the SPACE character.
 	 */
-	public String getHomotypicalSynonymName(Integer synonymIndex) {
-		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]"));
+	public String getHomotypicalGroupSynonymName(Integer synonymIndex) {
+		WebElement acceptedName = synonymy.findElement(
+				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[" + synonymIndex + "]")
+		);
 		return acceptedName.getText().replaceAll("\\s", " ");
 	}
 
+	public List<LinkElement> getHomotypicalGroupFootNoteKeys() {
+		List<WebElement> fnkListElements = synonymy.findElements(
+				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/*/span[contains(@class, 'footnote-key')]/a")
+		);
+		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
+	}
+
+	public List<BaseElement> getHomotypicalGroupFootNotes() {
+		List<WebElement> fnListElements = synonymy.findElements(
+				By.xpath("./ul[contains(@class,'homotypicSynonyms')]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnote')]")
+		);
+		return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
+
+	}
+
+
+
 	/**
 	 * @param heterotypicalGroupIndex
 	 *            the 0-based index of the heterotypical group
@@ -120,8 +150,23 @@ public class TaxonSynonymyPage extends PortalPage {
 	 *         and all information rendered after the name. All whitespace is
 	 *         normalized to the SPACE character.
 	 */
-	public String getHeterotypicalSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
-		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')]/li[" + synonymIndex + "]"));
+	public String getHeterotypicalGroupSynonymName(Integer heterotypicalGroupIndex, Integer synonymIndex) {
+		WebElement acceptedName = synonymy.findElement(By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[" + synonymIndex + "]"));
 		return acceptedName.getText().replaceAll("\\s", " ");
 	}
+
+	public List<LinkElement> getHeterotypicalGroupFootNoteKeys(Integer heterotypicalGroupIndex) {
+		List<WebElement> fnkListElements = synonymy.findElements(
+				By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/*/span[contains(@class, 'footnote-key')]/a")
+		);
+		return ElementUtils.linkElementsFromFootNoteKeyListElements(fnkListElements);
+	}
+
+	public List<BaseElement> getHeterotypicalGroupFootNotes(Integer heterotypicalGroupIndex) {
+		List<WebElement> fnListElements = synonymy.findElements(
+				By.xpath("./ul[contains(@class,'heterotypicSynonymyGroup')][" + heterotypicalGroupIndex + "]/li[contains(@class, 'footnotes')]/span[contains(@class, 'footnotes')]")
+		);
+		return ElementUtils.baseElementsFromFootNoteListElements(fnListElements);
+	}
+
 }
diff --git a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java
index 36b16a9e..4a3b8112 100644
--- a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java
+++ b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_HybridTest.java
@@ -53,7 +53,7 @@ public class Cichorieae_HybridTest extends CdmDataPortalTestBase{
 		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), lactuca_favratii_Uuid);
 		assertEquals(getContext().prepareTitle("Lactuca ×\"favratii\""), p.getTitle());
 	    assertEquals("Lactuca ×\"favratii\" , nom. provis.", p.getAcceptedName());
-		assertEquals("≡ Cicerbita ×favratii Wilczek in Bull. Soc. Vaud. Sci. Nat. 51: 333. 1917", p.getHomotypicalSynonymName(1));
+		assertEquals("≡ Cicerbita ×favratii Wilczek in Bull. Soc. Vaud. Sci. Nat. 51: 333. 1917", p.getHomotypicalGroupSynonymName(1));
 	}
 
 	@Test
@@ -61,9 +61,9 @@ public class Cichorieae_HybridTest extends CdmDataPortalTestBase{
 		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), crepis_oenipontana_Uuid);
 		assertEquals(getContext().prepareTitle("Crepis ×oenipontana"), p.getTitle());
 	    assertEquals("Crepis ×oenipontana Murr in Österr. Bot. Z. 43: 178. 1893", p.getAcceptedName());
-		assertEquals("= Crepis alpestris f. pseudalpestris Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalSynonymName(1, 1));
-		assertEquals("≡ Crepis alpestris var. pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalSynonymName(1, 2));
-		assertEquals("≡ Crepis ×pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 22: 66. 1916", p.getHeterotypicalSynonymName(1, 3));
+		assertEquals("= Crepis alpestris f. pseudalpestris Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalGroupSynonymName(1, 1));
+		assertEquals("≡ Crepis alpestris var. pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 14: 9. 1908", p.getHeterotypicalGroupSynonymName(1, 2));
+		assertEquals("≡ Crepis ×pseudalpestris (Murr) Murr in Allg. Bot. Z. Syst. 22: 66. 1916", p.getHeterotypicalGroupSynonymName(1, 3));
 	}
 
 	@Test
diff --git a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TechnicalAnnnotationsTest.java b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TechnicalAnnnotationsTest.java
index dc909500..665d793f 100644
--- a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TechnicalAnnnotationsTest.java
+++ b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_TechnicalAnnnotationsTest.java
@@ -9,6 +9,7 @@
  */
 package eu.etaxonomy.dataportal.selenium.tests.cichorieae;
 
+import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
 
 import java.net.MalformedURLException;
@@ -37,6 +38,8 @@ public class Cichorieae_TechnicalAnnnotationsTest extends CdmDataPortalTestBase{
 
 	static UUID soroseris_hookeriana_uuid = UUID.fromString("adaabef1-02f9-41a4-8a39-bf13564559f7");
 
+	static UUID pilosella_uuid = UUID.fromString("f42a07d1-d959-4838-b8ea-192b523ad5cc");
+
 
 	@Test
 	public void soroseris_hookeriana() throws MalformedURLException {
@@ -57,4 +60,18 @@ public class Cichorieae_TechnicalAnnnotationsTest extends CdmDataPortalTestBase{
 		assertEquals("expecting no footnotes", 0, creditsBlock.getFootNotes().size());
 	}
 
+	@Test
+	public void pilosella() throws MalformedURLException {
+		TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), pilosella_uuid);
+		String expectedName = "Pilosella";
+		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
+
+		assertEquals("Pilosella Vaill. in Königl. Akad. Wiss. Paris Phys. Abh. 5: 703. 1754", p.getAcceptedName());
+		assertEquals("Expecting one footnote key", 1, p.getAcceptedNameFootNoteKeys().size());
+		assertEquals("Expecting one footnote", 1, p.getHomotypicalGroupFootNotes().size());
+		String expectetToStartWith = "1. As has been discovered by Greuter & al. in Taxon 54: 166 (2005),";
+		assertTrue("Expecting footnote to start with: '" + expectetToStartWith + "' but was '" + p.getHomotypicalGroupFootNotes().get(0).getText() + "'"
+				, p.getHomotypicalGroupFootNotes().get(0).getText().startsWith(expectetToStartWith));
+	}
+
 }
diff --git a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java
index 7cdf24bf..723e210e 100644
--- a/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java
+++ b/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/test/java/eu/etaxonomy/dataportal/selenium/tests/cyprus/Cyprus_HybridTest.java
@@ -42,7 +42,7 @@ public class Cyprus_HybridTest extends CdmDataPortalTestBase{
 		String expectedName = "×Orchiserapias";
 		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
 		assertEquals(expectedName, p.getAcceptedName());
-		assertEquals("≡ Orchis × Serapias", p.getHomotypicalSynonymName(1));
+		assertEquals("≡ Orchis × Serapias", p.getHomotypicalGroupSynonymName(1));
 	}
 
 	@Test
@@ -51,7 +51,7 @@ public class Cyprus_HybridTest extends CdmDataPortalTestBase{
 		String expectedName = "Epilobium ×aschersonianum Hausskn.";
 		assertEquals(getContext().prepareTitle(expectedName), p.getTitle());
 		assertEquals(expectedName, p.getAcceptedName());
-		assertEquals("≡ Epilobium lanceolatum × parviflorum", p.getHomotypicalSynonymName(1));
+		assertEquals("≡ Epilobium lanceolatum × parviflorum", p.getHomotypicalGroupSynonymName(1));
 	}
 
 
