Project

General

Profile

« Previous | Next » 

Revision 111967be

Added by Andreas Müller almost 3 years ago

ref #9678 improve titleGeneration for derived units with empty field units

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/occurrence/DerivedUnitDefaultCacheStrategyTest.java
200 200
        Assert.assertEquals(correctCache, specimen.getTitleCache());
201 201
    }
202 202

  
203
    @Test
204
    public void testDerivedUnitWithEmptyFieldUnit() {
205
        specimen = DerivedUnit.NewPreservedSpecimenInstance();
206
        derivationEvent = DerivationEvent.NewInstance(DerivationEventType.ACCESSIONING());
207
        specimen.setDerivedFrom(derivationEvent);
208
        fieldUnit = FieldUnit.NewInstance();
209
        fieldUnit.addDerivationEvent(derivationEvent);
210
        gatheringEvent = GatheringEvent.NewInstance();
211
        fieldUnit.setGatheringEvent(gatheringEvent);
212
        Assert.assertEquals("DerivedUnit#0<"+specimen.getUuid()+">", specimen.getTitleCache());
213

  
214
        specimen.setBarcode("B996633");
215
        Assert.assertEquals("(B996633).", specimen.getTitleCache());  //maybe brackets and/or the full stop will be removed in future
216

  
217
    }
218

  
203 219
    private void addEcology(FieldUnit fieldUnit, String ecology) {
204 220
        SpecimenDescription description = SpecimenDescription.NewInstance(fieldUnit);
205 221
        TextData textData = TextData.NewInstance(Feature.ECOLOGY(), ecology, Language.DEFAULT(), null);

Also available in: Unified diff