Skip to content
Browse files

Test for bug: 1798 - Rename label removes all mols

Test that picks up the problem described in bug: #1798
  • Loading branch information...
1 parent 18fb49c commit e24a451b602b7271ab3af9873d9d185ef872ebc9 @jonalv jonalv committed Jan 7, 2010
View
27 ...uredb.plugintests/src/net/bioclipse/structuredb/AbstractStructuredbManagerPluginTest.java
@@ -583,4 +583,31 @@ public void testGetAvailablePropertiesFromAnnotation()
assertTrue( properties.contains( "p2" ) );
assertFalse( properties.contains( "p3" ) );
}
+
+ @Test
+ public void testBug1798RenameLabel() throws Exception {
+ DBMolecule m = structuredb.createMolecule( database1,
+ "test",
+ cdk.fromSMILES( "CCC" ) );
+ TextAnnotation a
+ = structuredb.createTextAnnotation( database1,
+ "test",
+ "annotation" );
+ structuredb.annotate( database1, m, a );
+ a.setValue( "edited" );
+ structuredb.save( database1, a );
+
+ Annotation loaded = annotationByValue( a.getValue() );
+
+ List<DBMolecule> dBMolecules = loaded.getDBMolecules();
+ assertEquals( 1, dBMolecules.size() );
+
+ assertEquals( m, dBMolecules.get( 0 ) );
+
+ a.removeDBMolecule( m );
+ structuredb.save( database1, a );
+ loaded = annotationByValue( a.getValue() );
+
+ assertEquals( 0, loaded.getDBMolecules().size() );
+ }
}

0 comments on commit e24a451

Please sign in to comment.
Something went wrong with that request. Please try again.