Skip to content

Commit

Permalink
test cases for the IQueryAtomContainer support in the SMSD with excep…
Browse files Browse the repository at this point in the history
…tions fixed

Signed-off-by: Syed Asad Rahman <s9asad@gmail.com>
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
asad authored and rajarshi committed May 20, 2010
1 parent b292f7c commit 839827b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 26 deletions.
Expand Up @@ -362,7 +362,7 @@ private void clearMaps() {
*
*/
private void init(MolHandler Reactant, MolHandler Product, boolean removeHydrogen) throws CDKException {
if (Reactant instanceof IQueryAtomContainer) {
if (Product instanceof IQueryAtomContainer) {
throw new CDKException(
"The first IAtomContainer must not be an IQueryAtomContainer");
}
Expand All @@ -388,7 +388,7 @@ private void init(MolHandler Reactant, MolHandler Product, boolean removeHydroge
@Override
@TestMethod("testInit_3args_1")
public void init(IMolecule Reactant, IMolecule Product, boolean removeHydrogen) throws CDKException {
if (Reactant instanceof IQueryAtomContainer) {
if (Product instanceof IQueryAtomContainer) {
throw new CDKException(
"The first IAtomContainer must not be an IQueryAtomContainer");
}
Expand All @@ -406,7 +406,7 @@ public void init(IMolecule Reactant, IMolecule Product, boolean removeHydrogen)
@Override
@TestMethod("testInit_3args_2")
public void init(IAtomContainer Reactant, IAtomContainer Product, boolean removeHydrogen) throws CDKException {
if (Reactant instanceof IQueryAtomContainer) {
if (Product instanceof IQueryAtomContainer) {
throw new CDKException(
"The first IAtomContainer must not be an IQueryAtomContainer");
}
Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import static org.junit.Assert.*;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.exception.InvalidSmilesException;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IMolecule;
Expand Down Expand Up @@ -58,9 +59,10 @@ public void testSubStructureSearchAlgorithms() {
/**
* Test of init method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testInit_3args_1() throws InvalidSmilesException {
public void testInit_3args_1() throws InvalidSmilesException, CDKException {
System.out.println("init");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IMolecule target = sp.parseSmiles("C\\C=C/OCC=C");
Expand All @@ -76,9 +78,10 @@ public void testInit_3args_1() throws InvalidSmilesException {
/**
* Test of init method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testInit_3args_2() throws InvalidSmilesException {
public void testInit_3args_2() throws InvalidSmilesException, CDKException {
System.out.println("init");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/OCC=C");
Expand Down Expand Up @@ -115,9 +118,10 @@ public void testInit_3args_3() throws Exception {
/**
* Test of setChemFilters method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testSetChemFilters() throws InvalidSmilesException {
public void testSetChemFilters() throws InvalidSmilesException, CDKException {
System.out.println("setChemFilters");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/OCC=C");
Expand All @@ -132,9 +136,10 @@ public void testSetChemFilters() throws InvalidSmilesException {
/**
* Test of getFragmentSize method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetFragmentSize() throws InvalidSmilesException {
public void testGetFragmentSize() throws InvalidSmilesException, CDKException {
System.out.println("getFragmentSize");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -150,9 +155,10 @@ public void testGetFragmentSize() throws InvalidSmilesException {
/**
* Test of getStereoScore method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetStereoScore() throws InvalidSmilesException {
public void testGetStereoScore() throws InvalidSmilesException, CDKException {
System.out.println("getStereoScore");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/OCC=C");
Expand All @@ -167,10 +173,11 @@ public void testGetStereoScore() throws InvalidSmilesException {

/**
* Test of getEnergyScore method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetEnergyScore() throws InvalidSmilesException {
public void testGetEnergyScore() throws InvalidSmilesException, CDKException {
System.out.println("getEnergyScore");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -186,9 +193,10 @@ public void testGetEnergyScore() throws InvalidSmilesException {
/**
* Test of getFirstMapping method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetFirstMapping() throws InvalidSmilesException {
public void testGetFirstMapping() throws InvalidSmilesException, CDKException {
System.out.println("getFirstMapping");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -203,10 +211,11 @@ public void testGetFirstMapping() throws InvalidSmilesException {

/**
* Test of getAllMapping method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetAllMapping() throws InvalidSmilesException {
public void testGetAllMapping() throws InvalidSmilesException, CDKException {
System.out.println("getAllMapping");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -222,9 +231,10 @@ public void testGetAllMapping() throws InvalidSmilesException {
/**
* Test of getFirstAtomMapping method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetFirstAtomMapping() throws InvalidSmilesException {
public void testGetFirstAtomMapping() throws InvalidSmilesException, CDKException {
System.out.println("getFirstAtomMapping");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -240,9 +250,10 @@ public void testGetFirstAtomMapping() throws InvalidSmilesException {
/**
* Test of getAllAtomMapping method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetAllAtomMapping() throws InvalidSmilesException {
public void testGetAllAtomMapping() throws InvalidSmilesException, CDKException {
System.out.println("getAllAtomMapping");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -258,9 +269,10 @@ public void testGetAllAtomMapping() throws InvalidSmilesException {
/**
* Test of getReactantMolecule method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetReactantMolecule() throws InvalidSmilesException {
public void testGetReactantMolecule() throws InvalidSmilesException, CDKException {
System.out.println("getReactantMolecule");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -276,9 +288,10 @@ public void testGetReactantMolecule() throws InvalidSmilesException {
/**
* Test of getProductMolecule method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetProductMolecule() throws InvalidSmilesException {
public void testGetProductMolecule() throws InvalidSmilesException, CDKException {
System.out.println("getProductMolecule");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand Down Expand Up @@ -313,9 +326,10 @@ public void testGetTanimotoSimilarity() throws Exception {
/**
* Test of isStereoMisMatch method, of class SubStructureSearchAlgorithms.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testIsStereoMisMatch() throws InvalidSmilesException {
public void testIsStereoMisMatch() throws InvalidSmilesException, CDKException {
System.out.println("isStereoMisMatch");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -332,7 +346,7 @@ public void testIsStereoMisMatch() throws InvalidSmilesException {
* @throws InvalidSmilesException
*/
@Test
public void testIsSubgraph() throws InvalidSmilesException {
public void testIsSubgraph() throws InvalidSmilesException, CDKException {
System.out.println("isSubgraph");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand Down
19 changes: 12 additions & 7 deletions src/test/org/openscience/cdk/smsd/filters/ChemicalFiltersTest.java
Expand Up @@ -31,6 +31,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.exception.InvalidSmilesException;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.smiles.SmilesParser;
Expand Down Expand Up @@ -89,10 +90,11 @@ public void testSortResultsByStereoAndBondMatch() throws Exception {

/**
* Test of sortResultsByFragments method, of class ChemicalFilters.
* @throws InvalidSmilesException
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testSortResultsByFragments() throws InvalidSmilesException {
public void testSortResultsByFragments() throws InvalidSmilesException, CDKException {
System.out.println("sortResultsByFragments");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand Down Expand Up @@ -176,10 +178,11 @@ public void testSortMapByValueInDecendingOrder() {

/**
* Test of getSortedEnergy method, of class ChemicalFilters.
* @throws InvalidSmilesException
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetSortedEnergy() throws InvalidSmilesException {
public void testGetSortedEnergy() throws InvalidSmilesException, CDKException {
System.out.println("getSortedEnergy");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -195,9 +198,10 @@ public void testGetSortedEnergy() throws InvalidSmilesException {
/**
* Test of getSortedFragment method, of class ChemicalFilters.
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetSortedFragment() throws InvalidSmilesException {
public void testGetSortedFragment() throws InvalidSmilesException, CDKException {
System.out.println("getSortedFragment");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
Expand All @@ -212,10 +216,11 @@ public void testGetSortedFragment() throws InvalidSmilesException {

/**
* Test of getStereoMatches method, of class ChemicalFilters.
* @throws InvalidSmilesException
* @throws InvalidSmilesException
* @throws CDKException
*/
@Test
public void testGetStereoMatches() throws InvalidSmilesException {
public void testGetStereoMatches() throws InvalidSmilesException, CDKException {
System.out.println("getStereoMatches");
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer target = sp.parseSmiles("C\\C=C/OCC=C");
Expand Down

0 comments on commit 839827b

Please sign in to comment.