Project

General

Profile

Revision 013e3b2f

ID013e3b2f5410c5b97bafa18a86a46c131baf5c64
Parent 51249b12
Child dd3ea7ac

Added by Andreas Müller over 1 year ago

ref #7666 allow formatting without name part (2. test)

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/format/TaxonRelationshipFormatterTest.java
40 40
 */
41 41
public class TaxonRelationshipFormatterTest {
42 42

  
43
    private static boolean WITHOUT_NAME = true;
44

  
43 45
    private TaxonRelationship taxonRel;
44 46
    private Reference relSec;
45 47

  
......
281 283
        String inverseSymbol = TaxonRelationshipType.MISAPPLIED_NAME_FOR().getInverseSymbol();
282 284
        String symbol = TaxonRelationshipType.MISAPPLIED_NAME_FOR().getSymbol();
283 285

  
284
        List<TaggedText> tags = formatter.getTaggedText(taxonRel, reverse, languages, true);
286
        List<TaggedText> tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
285 287
        String str = TaggedCacheHelper.createString(tags);
286 288
        Assert.assertEquals(inverseSymbol + " sensu Macfarlane 1918, err. sec. Cheek 1919: 123", str);
287 289

  
288 290
        //reverse
289
        tags = formatter.getTaggedText(taxonRel, !reverse, languages, true);
291
        tags = formatter.getTaggedText(taxonRel, !reverse, languages, WITHOUT_NAME);
290 292
        str = TaggedCacheHelper.createString(tags);
291 293
        Assert.assertEquals(symbol + " sec. ToSecAuthor 1928, rel. sec. Cheek 1919: 123", str);
292 294

  
293 295
        //auctores
294 296
        fromTaxon.setAppendedPhrase("auctores");
295
        tags = formatter.getTaggedText(taxonRel, reverse, languages, true);
297
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
296 298
        str = TaggedCacheHelper.createString(tags);
297 299
        Assert.assertEquals(inverseSymbol + " auctores sensu Macfarlane 1918, err. sec. Cheek 1919: 123", str);
298 300

  
299 301
        fromTaxon.setSec(null);
300 302
        fromTaxon.setAppendedPhrase("");
301
        tags = formatter.getTaggedText(taxonRel, reverse, languages, true);
303
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
302 304
        str = TaggedCacheHelper.createString(tags);
303 305
        Assert.assertEquals(inverseSymbol + " auct., err. sec. Cheek 1919: 123", str);
304 306

  
305 307
        fromTaxon.setDoubtful(true);
306
        tags = formatter.getTaggedText(taxonRel, reverse, languages, true);
308
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
307 309
        str = TaggedCacheHelper.createString(tags);
308 310
        System.out.println(str);
309 311
        Assert.assertEquals(inverseSymbol + " ?\u202F auct., err. sec. Cheek 1919: 123", str);
310 312

  
311 313
    }
312 314

  
315
    @Test
316
    public void testGetTaggedTextConceptRelationsWithoutName() {
317

  
318
        reverse = false;
319

  
320
        TaxonRelationshipType relType = TaxonRelationshipType.INCLUDES();
321

  
322
        final String SYMBOL = relType.getSymbol();
323

  
324
        taxonRel.setType(relType);
325
        List<TaggedText> tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
326
        String str = TaggedCacheHelper.createString(tags);
327
        Assert.assertEquals(SYMBOL + " sec. ToSecAuthor 1928, rel. sec. Cheek 1919: 123", str);
328

  
329
        tags = formatter.getTaggedText(taxonRel, !reverse, languages, WITHOUT_NAME);
330
        str = TaggedCacheHelper.createString(tags);
331
        Assert.assertEquals(relType.getInverseSymbol() + " sec. Macfarlane 1918, rel. sec. Cheek 1919: 123", str);
332

  
333
        toTaxon.setAppendedPhrase("sensu stricto");
334
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
335
        str = TaggedCacheHelper.createString(tags);
336
        Assert.assertEquals(SYMBOL + " sensu stricto sec. ToSecAuthor 1928, rel. sec. Cheek 1919: 123", str);
337

  
338
        toTaxon.setSec(null);
339
        toTaxon.setAppendedPhrase("");
340
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
341
        str = TaggedCacheHelper.createString(tags);
342
        Assert.assertEquals(SYMBOL + " sec. ???, rel. sec. Cheek 1919: 123", str);
343

  
344
        taxonRel.setDoubtful(true);
345
        toTaxon.setAppendedPhrase("");
346
        tags = formatter.getTaggedText(taxonRel, reverse, languages, WITHOUT_NAME);
347
        str = TaggedCacheHelper.createString(tags);
348
        Assert.assertEquals("?" + SYMBOL + " sec. ???, rel. sec. Cheek 1919: 123", str);
349

  
350
    }
351

  
313 352
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)