Project

General

Profile

« Previous | Next » 

Revision ab1f58a9

Added by Andreas Müller over 3 years ago

ref #9279 improve TypeDesignationSetManager

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TypeDesignationSetManagerTest.java
178 178
        @Test
179 179
        public void test1() throws RegistrationValidationException{
180 180

  
181
            @SuppressWarnings("rawtypes")
181 182
            List<TypeDesignationBase> tds = new ArrayList<>();
182 183
            tds.add(ntd);
183 184
            tds.add(std_IT);
......
195 196
            typifiedName.addTypeDesignation(std_IT_3, false);
196 197

  
197 198
            TypeDesignationSetManager typeDesignationManager = new TypeDesignationSetManager(tds);
198
            String result = typeDesignationManager.print();
199
            String result = typeDesignationManager.print(true, true, true);
199 200

  
200 201
//            Logger.getLogger(this.getClass()).debug(result);
201 202
            assertNotNull(result);
202
            //FIXME #9263
203 203
            assertEquals(
204
                    "Prionus L. Type: Dreamland, near Kissingen, A.Kohlbecker 66211, 2017 isotype: M;"
205
                    + " Type: Testland, near Bughausen, A.Kohlbecker 81989, 2017 holotype: OHA; isotypes: BER, KEW;"
204
                    "Prionus L.\u202F\u2013\u202FTypes: Dreamland, near Kissingen, A.Kohlbecker 66211, 2017 (isotype: M);"
205
                    + " Testland, near Bughausen, A.Kohlbecker 81989, 2017 (holotype: OHA; isotypes: BER, KEW);"
206 206
                    + " Nametype: Prionus coriatius L."
207 207
                    , result
208 208
                    );
209 209

  
210
            @SuppressWarnings("rawtypes")
210 211
            LinkedHashMap<TypedEntityReference, TypeDesignationWorkingSet> orderedTypeDesignations =
211 212
                    typeDesignationManager.getOrderdTypeDesignationWorkingSets();
212 213
            Iterator<TypeDesignationWorkingSet> byStatusMapIterator = orderedTypeDesignations.values().iterator();
......
226 227
            typifiedName.setTitleCache("Prionus L.", true);
227 228

  
228 229
            TypeDesignationSetManager typeDesignationManager = new TypeDesignationSetManager(typifiedName);
229
            String result = typeDesignationManager.print();
230
            String result = typeDesignationManager.print(true, true, true);
230 231
//            Logger.getLogger(this.getClass()).debug(result);
231 232
            assertNotNull(result);
232 233
            assertEquals(
......
238 239
            typeDesignationManager.addTypeDesigations(ntd);
239 240

  
240 241
            assertEquals(
241
                    "Prionus L. Nametype: Prionus coriatius L."
242
                    , typeDesignationManager.print()
242
                    "Prionus L.\u202F\u2013\u202FNametype: Prionus coriatius L."
243
                    , typeDesignationManager.print(true, true, true)
243 244
                    );
244 245

  
245 246
            typifiedName.addTypeDesignation(std_HT, false);
246 247
            typeDesignationManager.addTypeDesigations(std_HT);
247 248

  
248
            //FIXME #9263
249 249
            assertEquals(
250
                    "Prionus L. Type: Testland, near Bughausen, A.Kohlbecker 81989, 2017 holotype: OHA; Nametype: Prionus coriatius L."
251
                    , typeDesignationManager.print()
250
                    "Prionus L.\u202F\u2013\u202FTypes: Testland, near Bughausen, A.Kohlbecker 81989, 2017 (holotype: OHA); Nametype: Prionus coriatius L."
251
                    , typeDesignationManager.print(true, true, true)
252 252
                    );
253 253
        }
254 254

  
......
263 263
            citation.setDatePublished(TimePeriodParser.parseStringVerbatim("1989"));
264 264
            citation.setAuthorship(Team.NewTitledInstance("Miller", "Mill."));
265 265
            std_LT.addPrimaryTaxonomicSource(citation, "55");
266
            typeDesignationManager.buildString(true);
267
            assertEquals("Prionus coriatius L. Testland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC designated by Decandolle & al. (1962) [fide Miller (1989)])",
268
                    typeDesignationManager.print());
266
            assertEquals("Prionus coriatius L.\u202F\u2013\u202FTestland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC designated by Decandolle & al. (1962) [fide Miller (1989)])",
267
                    typeDesignationManager.print(true, false, true));
268
            assertEquals("Prionus coriatius L.\u202F\u2013\u202FTestland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC)",
269
                    typeDesignationManager.print(false, false, true));
269 270

  
270 271
            typifiedName = TaxonNameFactory.NewBacterialInstance(Rank.GENUS());
271 272
            typifiedName.setTitleCache("Prionus L.", true);
272 273
            typeDesignationManager = new TypeDesignationSetManager(typifiedName);
273 274
            typeDesignationManager.addTypeDesigations(ntd_LT);
274 275
            ntd_LT.addPrimaryTaxonomicSource(citation, "66");
275
            typeDesignationManager.buildString(true);
276
            //TODO capital letter or not still needs to be discussed, currently it differs for SpecimenTD and NameTD in original csv data
277
            assertEquals("Prionus L. (lectotype: Prionus arealus L. designated by Decandolle & al. (1962) [fide Miller (1989)])",
278
                    typeDesignationManager.print());
276
            assertEquals("Prionus L.\u202F\u2013\u202FLectotype: Prionus arealus L. designated by Decandolle & al. (1962) [fide Miller (1989)]",
277
                    typeDesignationManager.print(true, false, true));
278
            assertEquals("Prionus L.\u202F\u2013\u202FLectotype: Prionus arealus L.",
279
                    typeDesignationManager.print(false, false, true));
279 280
        }
280 281

  
281 282
        @Test
......
293 294
                typeDesignationManager.addTypeDesigations(mtd_HT_published);
294 295
                typeDesignationManager.addTypeDesigations(mtd_IT_unpublished);
295 296

  
296
                //FIXME #9263
297 297
                assertEquals("failed after repreating " + i + " times",
298
                        "Prionus coriatius L. Type: Testland, near Bughausen, A.Kohlbecker 81989, 2017 holotype: [icon] p.33 in A.K. & W.K (2008) Algae of the BGBM; isotype: [icon] B Slide A565656."
299
                        , typeDesignationManager.print()
298
                        "Prionus coriatius L.\u202F\u2013\u202FTypes: Testland, near Bughausen, A.Kohlbecker 81989, 2017 (holotype: [icon] p.33 in A.K. & W.K (2008) Algae of the BGBM; isotype: [icon] B Slide A565656)"
299
                        , typeDesignationManager.print(true, true, true)
300 300
                        );
301 301
            }
302 302
        }

Also available in: Unified diff