use of org.openscience.cdk.config.AtomTypeFactory in project cdk by cdk.
the class CDKAtomTypeMatcherTest method testAllElementsRepresented.
/**
* Test if all elements up to and including Uranium have atom types.
*
* @throws Exception
*/
@Test
public void testAllElementsRepresented() throws Exception {
AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", SilentChemObjectBuilder.getInstance());
Assert.assertTrue("Could not read the atom types", factory.getSize() != 0);
String errorMessage = "Elements without atom type(s) defined in the XML:";
// TODO: 92 ?
final int testUptoAtomicNumber = 36;
int elementsMissingTypes = 0;
for (int i = 1; i < testUptoAtomicNumber; i++) {
String symbol = PeriodicTable.getSymbol(i);
IAtomType[] expectedTypes = factory.getAtomTypes(symbol);
if (expectedTypes.length == 0) {
errorMessage += " " + symbol;
elementsMissingTypes++;
}
}
Assert.assertEquals(errorMessage, 0, elementsMissingTypes);
}
Aggregations