IsotopePatternRule implements IRule { @Override public void setParameters(Object[] params) throws CDKException { if (params.length != 2) throw new CDKException("IsotopePatternRule expects two parameter"); if (!(params[0] instanceof List)) throw new CDKException("The parameter one must be of type List<Double[]>"); if (!(params[1] instanceof Double)) throw new CDKException("The parameter two must be of type Double"); pattern = new IsotopePattern(); for (double[] listISO : (List<double[]>) params[0]) { pattern.addIsotope(new IsotopeContainer(listISO[0], listISO[1])); } is.seTolerance((Double) params[1]); } IsotopePatternRule(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override double validate(IMolecularFormula formula);  }
@Test public void testSetParameters() throws Exception { IRule rule = new IsotopePatternRule(); Object[] params = new Object[2]; params[0] = new ArrayList<Double[]>(); params[1] = 0.0001; rule.setParameters(params); Object[] objects = rule.getParameters(); Assert.assertNotNull(objects[0]); Assert.assertEquals(2, objects.length); }