Skip to content

Commit

Permalink
Unit test to reproduce failing atom type perception with one of the o…
Browse files Browse the repository at this point in the history
…ptions to create a -1 Integer object

Signed-off-by: maclean <gilleain.torrance@gmail.com>
  • Loading branch information
egonw committed Sep 10, 2010
1 parent 223fc9a commit 9c1b95a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
Expand Up @@ -3253,6 +3253,30 @@ public void testNOxide() throws Exception {
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

/**
* @cdk.bug 3061263
*/
@Test public void testFormalChargeRepresentation() throws Exception {
IMolecule mol = new Molecule();
IAtom atom = new Atom("O");
final IAtomType.Hybridization thisHybridization = IAtomType.Hybridization.SP3;
atom.setHybridization(thisHybridization);
mol.addAtom(atom);
String[] expectedTypes = {"O.minus"};

// option one: Integer.valueOf()
atom.setFormalCharge(Integer.valueOf(-1));
assertAtomTypes(testedAtomTypes, expectedTypes, mol);

// option one: autoboxing
atom.setFormalCharge(-1);
assertAtomTypes(testedAtomTypes, expectedTypes, mol);

// option one: new Integer()
atom.setFormalCharge(new Integer(-1));
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test public void countTestedAtomTypes() {
super.countTestedAtomTypes(testedAtomTypes);
}
Expand Down

0 comments on commit 9c1b95a

Please sign in to comment.