diff --git a/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java b/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java index 21e2d7ae39d..e7f32b753d6 100644 --- a/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java +++ b/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java @@ -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); }