public void testCostExceptions() throws ConvergenceException {
CostFunction wrong =
new CostFunction() {
public double cost(double[] x) throws CostException {
if (x[0] < 0) {
throw new CostException("{0}", new Object[] { "oops"});
} else if (x[0] > 1) {
throw new CostException(new RuntimeException("oops"));
} else {
return x[0] * (1 - x[0]);
}
}
};