Project

General

Profile

Download (7.74 KB) Statistics
| Branch: | Tag: | Revision:
1 761340e4 Andreas Kohlbecker
/**
2
 * Copyright (C) 2009 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9
package eu.etaxonomy.dataportal.selenium.tests.reference;
10
11
import java.net.MalformedURLException;
12
import java.util.List;
13
import java.util.UUID;
14
15
import org.junit.Before;
16 e5926729 Andreas Kohlbecker
import org.junit.Ignore;
17 761340e4 Andreas Kohlbecker
import org.junit.Test;
18
import org.openqa.selenium.WebElement;
19
20 2ae1c797 Andreas Kohlbecker
import eu.etaxonomy.cdm.common.UTF8;
21 fadab744 Andreas Kohlbecker
import eu.etaxonomy.dataportal.DataPortalSite;
22 761340e4 Andreas Kohlbecker
import eu.etaxonomy.dataportal.ElementUtils;
23 41fb1151 Andreas Kohlbecker
import eu.etaxonomy.dataportal.StringConstants;
24 761340e4 Andreas Kohlbecker
import eu.etaxonomy.dataportal.elements.BaseElement;
25 7e1f5d18 Andreas Kohlbecker
import eu.etaxonomy.dataportal.elements.LinkElement;
26 761340e4 Andreas Kohlbecker
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
27
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
28
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
29
30
/**
31 41fb1151 Andreas Kohlbecker
 * Issues to be covered by this TestClass:
32
 *
33
 * #5676
34 5cfd066c Andreas Kohlbecker
 * #5647
35
 * #5492
36
 * #7658 + #6682
37 41fb1151 Andreas Kohlbecker
 *
38 761340e4 Andreas Kohlbecker
 * @author a.kohlbecker
39
 *
40
 */
41
42 fadab744 Andreas Kohlbecker
@DataPortalContexts( { DataPortalSite.reference })
43 761340e4 Andreas Kohlbecker
public class MisappliedNamesTest extends CdmDataPortalTestBase{
44
45
    static final UUID miconia_cubacinerea_Uuid = UUID.fromString("c6716cee-2039-4ba8-a239-4b1b353f9c84");
46
47 41fb1151 Andreas Kohlbecker
    static final UUID trichocentrum_undulatum_Uuid = UUID.fromString("7e86b2a4-ba71-4494-b544-ae5656e02ed2");
48
49 5cfd066c Andreas Kohlbecker
    static final UUID nepenthes_abalata_Uuid = UUID.fromString("9b588d8a-c4fa-430a-b9c7-026bf715ecf6");
50
51 761340e4 Andreas Kohlbecker
    @Before
52
    public void setUp() throws Exception {
53
        driver.get(getContext().getBaseUri().toString());
54
    }
55
56
    /**
57 439f531a Andreas Kohlbecker
     * Test for correct sensu representation of misapplied names, see #5676, #5647 and #7658
58 41fb1151 Andreas Kohlbecker
     *
59
     * https://dev.e-taxonomy.eu/redmine/issues/5647
60 439f531a Andreas Kohlbecker
     * https://dev.e-taxonomy.eu/redmine/issues/7658
61 41fb1151 Andreas Kohlbecker
     *
62
     * NOTE: Species solaris has no authorship!!
63 761340e4 Andreas Kohlbecker
     */
64
    @Test
65 41fb1151 Andreas Kohlbecker
    public void tesIssue5647() throws MalformedURLException {
66 761340e4 Andreas Kohlbecker
67
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
68
69 e56e5d1c Andreas Kohlbecker
        // no sensu but with Combination Authors:
70 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n\"Ossaea angustifolia\" auct., non Cheek", p.getMisappliedName(1).getText());
71 e56e5d1c Andreas Kohlbecker
        //
72 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n\"Ossaea glomerata\" sensu A&S1; sensu A&S: 221; sensu A&S: 331; sensu Lem2; sensu Species solaris; auct.; auct. sensu A&S1; auctrs. afr.", p.getMisappliedName(2).getText());
73 439f531a Andreas Kohlbecker
        // with doubtful flag
74 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n" + StringConstants.DOUBTFULMARKER_SPACE +"\"Ossaea glomerata\" sensu A&S1", p.getMisappliedName(3).getText());
75 45aaf1fe Andreas Kohlbecker
76 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EM_DASH_DOUBLE + "(p.p.)\nOssaea glomerata sec. A&S1; sec. Species solaris", p.getMisappliedName(4).getText());
77 45aaf1fe Andreas Kohlbecker
78 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EM_DASH_DOUBLE + "(part.)\nOssaea glomerata sec. A&S: 331; auct. sec. A&S1", p.getMisappliedName(5).getText());
79 27c31249 Andreas Kohlbecker
        // Test also invalid designation which is rendered with the misapplied names
80 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\nOssaea maculata sec. Lem2, rel. sec. A&S1", p.getMisappliedName(6).getText());
81 45aaf1fe Andreas Kohlbecker
82 761340e4 Andreas Kohlbecker
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
83 ca2ed7a5 Andreas Kohlbecker
        assertEquals(2, footnotes.size());
84 10e3087e Andreas Kohlbecker
        assertEquals("1. A&S, Plantas vasculares de Oz", footnotes.get(0).getText());
85
        assertEquals("2. Lem, New Species in the solar system", footnotes.get(1).getText());
86 23ebb91f Andreas Kohlbecker
        // "Species solaris" must not be in the footnotes as it has the same title as the short citation
87 761340e4 Andreas Kohlbecker
88
    }
89
90 e5926729 Andreas Kohlbecker
    /**
91
     * Test to reproduce issue https://dev.e-taxonomy.eu/redmine/issues/7766
92
     *
93
     * TODO merge with  tesIssue5647 () once fixed
94
     *
95
     */
96
    @Test
97
    @Ignore
98
    public void tesIssue7766() throws MalformedURLException {
99
100
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
101
102
        assertEquals("≜⊃\nTrichocentrum undulatum (Sw.) Ackerman & M. W. Chase sec. My Classification3", p.getTaxonRelationships(1).getText());
103
        assertEquals("∅ Achilllea santolina Lag. sec. Testor 2018+4", p.getTaxonRelationships(1).getText());
104
105
106
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
107
        assertEquals(4, footnotes.size());
108
        assertEquals("1. A&S, Plantas vasculares de Oz", footnotes.get(0).getText());
109
        assertEquals("2. Lem, New Species in the solar system", footnotes.get(1).getText());
110
        assertEquals("3. Kohlbecker, .....TODO .... 2016-2018", footnotes.get(0).getText());
111
        assertEquals("4. Testor ... TODO ... 2018+", footnotes.get(1).getText());
112
113
    }
114
115 7e1f5d18 Andreas Kohlbecker
    /**
116
     * https://dev.e-taxonomy.eu/redmine/issues/7778
117
     *
118
     * @throws MalformedURLException
119
     */
120
    @Test
121
    public void tesIssue7778() throws MalformedURLException {
122
123
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
124
125
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
126
        BaseElement footNote = footnotes.get(0);
127
        assertEquals("1. A&S, Plantas vasculares de Oz", footNote.getText());
128
        List<LinkElement> links = footNote.getLinksInElement();
129
        assertEquals(1, links.size());
130 c714960c Andreas Kohlbecker
        assertEquals("http://doi.org/10.1111/j.1756-1051.2012.00012.x", links.get(0).getUrl());
131 7e1f5d18 Andreas Kohlbecker
132
    }
133
134 761340e4 Andreas Kohlbecker
135 41fb1151 Andreas Kohlbecker
    /**
136
     * https://dev.e-taxonomy.eu/redmine/issues/5492
137
     */
138
    @Test
139
    public void testIssue5492() throws MalformedURLException {
140
141
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), trichocentrum_undulatum_Uuid);
142
143
        WebElement misappliedName1 = p.getMisappliedName(1);
144
        assertNotNull(misappliedName1);
145 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n" + StringConstants.DOUBTFULMARKER_SPACE +"\"Oncidium carthaginense\" auct. sensu Greuter, W. & Rankin Rodríguez, R1", misappliedName1.getText());
146 41fb1151 Andreas Kohlbecker
147
        WebElement misappliedName2 = p.getMisappliedName(2);
148
        assertNotNull(misappliedName2);
149 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n\"Oncidium guttatum\" auct. sensu Greuter, W. & Rankin Rodríguez, R1", misappliedName2.getText());
150 67c8cca9 Andreas Kohlbecker
151 41fb1151 Andreas Kohlbecker
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
152
        assertEquals(1, footnotes.size());
153
        assertEquals("1. Greuter, W. & Rankin Rodríguez, R, Plantas vasculares de Cuba: inventario preliminar. Tercera edición, actualizada. Vascular plants of Cuba: a preliminary checklist. Third updated edition.", footnotes.get(0).getText());
154
    }
155
156 5cfd066c Andreas Kohlbecker
    /**
157
     * https://dev.e-taxonomy.eu/redmine/issues/7658
158
     * https://dev.e-taxonomy.eu/redmine/issues/6682
159 83dc60b9 Andreas Kohlbecker
     *
160 67c8cca9 Andreas Kohlbecker
     * TODO 1b) Der Buchlink verweist auf den Protolog von N. blancoi Blume – der hat ja aber gerade nichts mit
161
     * dieser Namensanwendung zu tun (also: Protologbildlinks müssen bei MAN weggelassen werden oder der Link
162
     * muss nach dem <non Blume> eingefügt werden)
163 5cfd066c Andreas Kohlbecker
     */
164
    @Test
165
    public void testIssue7658() throws MalformedURLException {
166
167
168
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), nepenthes_abalata_Uuid);
169 41fb1151 Andreas Kohlbecker
170 5cfd066c Andreas Kohlbecker
        WebElement misappliedName1 = p.getMisappliedName(1);
171
        assertNotNull(misappliedName1);
172 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n\"Nepenthes alata\" pro parte, sensu Cheek, M.R. & Jebb, M.H.P. 20011, non Blanco, err. sec. Cheek, M.R. & Jebb, M.H.P. 20132", misappliedName1.getText());
173 5cfd066c Andreas Kohlbecker
174
        WebElement misappliedName2 = p.getMisappliedName(2);
175
        assertNotNull(misappliedName2);
176 2ae1c797 Andreas Kohlbecker
        assertEquals(UTF8.EN_DASH + "\n\"Nepenthes blancoi\" pro parte, sensu Macfarlane 19083, non Blume, err. sec. Cheek, M.R. & Jebb, M.H.P. 20132", misappliedName2.getText());
177 5cfd066c Andreas Kohlbecker
178
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
179 67c8cca9 Andreas Kohlbecker
        assertEquals(3, footnotes.size());
180 5cfd066c Andreas Kohlbecker
   }
181 761340e4 Andreas Kohlbecker
182
}