Project

General

Profile

« Previous | Next » 

Revision f1d41e41

Added by Andreas Müller over 12 years ago

bugfix for failing test on bidirectionality specimen - typeDesignation

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/SpecimenTypeDesignation.java
159 159
		if (this.typeSpecimen != null){
160 160
			this.typeSpecimen.removeSpecimenTypeDesignation(this);
161 161
		}
162
		this.typeSpecimen = typeSpecimen;
163 162
		if (typeSpecimen != null && ! typeSpecimen.getSpecimenTypeDesignations().contains(this)){
164 163
			typeSpecimen.addSpecimenTypeDesignation(this);
165 164
		}
165
		this.typeSpecimen = typeSpecimen;
166 166
	}
167 167

  
168 168
	/* (non-Javadoc)
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/SpecimenTypeDesignationTest.java
70 70
	@Test
71 71
	public void testBidirectionalRelationship(){
72 72
		term2 = new SpecimenTypeDesignation(Specimen.NewInstance(), SpecimenTypeDesignationStatus.ISOTYPE(), 
73
				null, null, null, false);;
73
				null, null, null, false);
74 74
		Specimen specimen = (Specimen) term2.getTypeSpecimen();
75 75
		Set<SpecimenTypeDesignation> set = specimen.getSpecimenTypeDesignations();
76 76
		boolean contains = false;
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/occurrence/SpecimenTest.java
127 127
		
128 128
		desig1.setTypeSpecimen(null);
129 129
		Assert.assertEquals("Desig1 should not have a specimen anymore", null, desig1.getTypeSpecimen());
130
		Assert.assertEquals("Specimen1 should have no designation", 1, specimen.getSpecimenTypeDesignations().size());
130
		Assert.assertEquals("Specimen1 should have 1 designation", 1, specimen.getSpecimenTypeDesignations().size());
131 131
		Assert.assertEquals("Specimen1's designation should be desig2", desig2, specimen.getSpecimenTypeDesignations().iterator().next());
132 132
		
133
		desig1.setTypeSpecimen(specimen);
134
		Assert.assertEquals("Desig1 should have specimen1 as specimen again", specimen, desig1.getTypeSpecimen());
135
		Assert.assertEquals("Specimen1 should have 2 designation", 2, specimen.getSpecimenTypeDesignations().size());
136
		
133 137
	}
134 138
	
135 139

  

Also available in: Unified diff