Skip to content

Commit

Permalink
Test for bug: 1798 - Rename label removes all mols
Browse files Browse the repository at this point in the history
Test that picks up the problem described in bug: #1798
  • Loading branch information
jonalv committed Jan 7, 2010
1 parent 18fb49c commit e24a451
Showing 1 changed file with 27 additions and 0 deletions.
Expand Up @@ -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.