Project

General

Profile

Download (7.97 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
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
import org.junit.Test;
17
import org.openqa.selenium.WebElement;
18

    
19
import eu.etaxonomy.cdm.common.UTF8;
20
import eu.etaxonomy.dataportal.DataPortalSite;
21
import eu.etaxonomy.dataportal.ElementUtils;
22
import eu.etaxonomy.dataportal.StringConstants;
23
import eu.etaxonomy.dataportal.elements.BaseElement;
24
import eu.etaxonomy.dataportal.elements.LinkElement;
25
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
26
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
27
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
28

    
29
/**
30
 * Issues to be covered by this TestClass:
31
 *
32
 * #5676
33
 * #5647
34
 * #5492
35
 * #7658 + #6682
36
 *
37
 * @author a.kohlbecker
38
 *
39
 */
40

    
41
@DataPortalContexts( { DataPortalSite.reference })
42
public class MisappliedNamesTest extends CdmDataPortalTestBase{
43

    
44
    static final UUID miconia_cubacinerea_Uuid = UUID.fromString("c6716cee-2039-4ba8-a239-4b1b353f9c84");
45

    
46
    static final UUID trichocentrum_undulatum_Uuid = UUID.fromString("7e86b2a4-ba71-4494-b544-ae5656e02ed2");
47

    
48
    static final UUID nepenthes_abalata_Uuid = UUID.fromString("9b588d8a-c4fa-430a-b9c7-026bf715ecf6");
49

    
50
    @Before
51
    public void setUp() throws Exception {
52
        driver.get(getContext().getBaseUri().toString());
53
    }
54

    
55
    /**
56
     * Test for correct sensu representation of misapplied names, see #5676, #5647 and #7658
57
     *
58
     * https://dev.e-taxonomy.eu/redmine/issues/5647
59
     * https://dev.e-taxonomy.eu/redmine/issues/7658
60
     * https://dev.e-taxonomy.eu/redmine/issues/7766
61
     *
62
     * The expected sort order is:
63
     * <ol>
64
     *   <li>pro parte/partial synonyms</li>
65
     *   <li>then invalid designations</li>
66
     *   <li>then MANs</li>
67
     *   <li>followed (or including?) pro parte/partial MAN</li>
68
     *   <li>and finally concept relationships.</li>
69
     *</ol>
70
     * (see https://dev.e-taxonomy.eu/redmine/issues/7766)
71
     *
72
     * NOTE: Species solaris has no authorship!!
73
     */
74
    @Test
75
    public void tesIssue5647() throws MalformedURLException {
76

    
77
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
78

    
79
        assertEquals(UTF8.EM_DASH_DOUBLE + "(p.p.)\nOssaea glomerata sec. A&S1; sec. Species solaris", p.getMisappliedName(1).getText());
80

    
81
        assertEquals(UTF8.EM_DASH_DOUBLE + "(part.)\nOssaea glomerata sec. A&S: 331; auct. sec. A&S1", p.getMisappliedName(2).getText());
82

    
83
        // Test also invalid designation which is rendered with the misapplied names
84
        assertEquals(UTF8.EN_DASH + "\nOssaea maculata sec. Lem2, rel. sec. A&S1", p.getMisappliedName(3).getText());
85

    
86
        // no sensu but with Combination Authors:
87
        assertEquals(UTF8.EN_DASH + "\n\"Ossaea angustifolia\" auct., non Cheek", p.getMisappliedName(4).getText());
88
        //
89
        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(5).getText());
90

    
91
        // TODO the order of the MANs is not always defined please see #7766
92
        // with doubtful flag
93
        assertEquals(UTF8.EN_DASH + "\n" + StringConstants.DOUBTFULMARKER_SPACE +"\"Ossaea glomerata\" sensu A&S1", p.getMisappliedName(6).getText());
94

    
95

    
96

    
97
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
98
        assertEquals(2, footnotes.size());
99
        assertEquals("1. A&S, Plantas vasculares de Oz", footnotes.get(0).getText());
100
        assertEquals("2. Lem, New Species in the solar system", footnotes.get(1).getText());
101
        // "Species solaris" must not be in the footnotes as it has the same title as the short citation
102

    
103
    }
104

    
105
    /**
106
     * Test to reproduce issue https://dev.e-taxonomy.eu/redmine/issues/7766
107
     */
108
    @Test
109
    public void tesIssue7766() throws MalformedURLException {
110

    
111
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
112

    
113
        assertEquals("≜⊃\nTrichocentrum undulatum (Sw.) Ackerman & M. W. Chase sec. Kohlbecker 2016–2018", p.getTaxonRelationships(1).getText());
114
        assertEquals("∅\nAchilllea santolina Lag. sec. Testor 2018+, rel. sec. A&S: 35", p.getTaxonRelationships(2).getText());
115

    
116

    
117
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
118
        assertEquals(2, footnotes.size());
119
        assertEquals("1. A&S, Plantas vasculares de Oz", footnotes.get(0).getText());
120
        assertEquals("2. Lem, New Species in the solar system", footnotes.get(1).getText());
121
    }
122

    
123
    /**
124
     * https://dev.e-taxonomy.eu/redmine/issues/7778
125
     *
126
     * @throws MalformedURLException
127
     */
128
    @Test
129
    public void tesIssue7778() throws MalformedURLException {
130

    
131
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), miconia_cubacinerea_Uuid);
132

    
133
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
134
        BaseElement footNote = footnotes.get(0);
135
        assertEquals("1. A&S, Plantas vasculares de Oz", footNote.getText());
136
        List<LinkElement> links = footNote.getLinksInElement();
137
        assertEquals(1, links.size());
138
        assertEquals("http://doi.org/10.1111/j.1756-1051.2012.00012.x", links.get(0).getUrl());
139

    
140
    }
141

    
142

    
143
    /**
144
     * https://dev.e-taxonomy.eu/redmine/issues/5492
145
     */
146
    @Test
147
    public void testIssue5492() throws MalformedURLException {
148

    
149
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), trichocentrum_undulatum_Uuid);
150

    
151
        WebElement misappliedName1 = p.getMisappliedName(1);
152
        assertNotNull(misappliedName1);
153
        assertEquals(UTF8.EN_DASH + "\n" + StringConstants.DOUBTFULMARKER_SPACE +"\"Oncidium carthaginense\" auct. sensu Greuter, W. & Rankin Rodríguez, R1", misappliedName1.getText());
154

    
155
        WebElement misappliedName2 = p.getMisappliedName(2);
156
        assertNotNull(misappliedName2);
157
        assertEquals(UTF8.EN_DASH + "\n\"Oncidium guttatum\" auct. sensu Greuter, W. & Rankin Rodríguez, R1", misappliedName2.getText());
158

    
159
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
160
        assertEquals(1, footnotes.size());
161
        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());
162
    }
163

    
164
    /**
165
     * https://dev.e-taxonomy.eu/redmine/issues/7658
166
     * https://dev.e-taxonomy.eu/redmine/issues/6682
167
     *
168
     * TODO 1b) Der Buchlink verweist auf den Protolog von N. blancoi Blume – der hat ja aber gerade nichts mit
169
     * dieser Namensanwendung zu tun (also: Protologbildlinks müssen bei MAN weggelassen werden oder der Link
170
     * muss nach dem <non Blume> eingefügt werden)
171
     */
172
    @Test
173
    public void testIssue7658() throws MalformedURLException {
174

    
175

    
176
        TaxonSynonymyPage p = new TaxonSynonymyPage(driver, getContext(), nepenthes_abalata_Uuid);
177

    
178
        WebElement misappliedName1 = p.getMisappliedName(1);
179
        assertNotNull(misappliedName1);
180
        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());
181

    
182
        WebElement misappliedName2 = p.getMisappliedName(2);
183
        assertNotNull(misappliedName2);
184
        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());
185

    
186
        List<BaseElement> footnotes = ElementUtils.findFootNotes(p.getTaxonRelationships());
187
        assertEquals(3, footnotes.size());
188
   }
189

    
190
}
(3-3/8)