1 16 17 package org.apache.commons.math; 18 19 import junit.framework.TestCase; 20 21 24 public class FunctionEvaluationExceptionTest extends TestCase { 25 26 public void testConstructor(){ 27 FunctionEvaluationException ex = new FunctionEvaluationException(0.0); 28 assertNull(ex.getCause()); 29 assertNotNull(ex.getMessage()); 30 assertEquals(0.0, ex.getArgument(), 0); 31 } 32 33 public void testConstructorMessage(){ 34 String msg = "message"; 35 FunctionEvaluationException ex = new FunctionEvaluationException(0.0, msg); 36 assertNull(ex.getCause()); 37 assertTrue(ex.getMessage().startsWith(msg)); 38 assertTrue(ex.getMessage().indexOf("0") > 0); 39 assertEquals(0.0, ex.getArgument(), 0); 40 } 41 42 public void testConstructorMessageCause(){ 43 String outMsg = "outer message"; 44 String inMsg = "inner message"; 45 Exception cause = new Exception (inMsg); 46 FunctionEvaluationException ex = new FunctionEvaluationException(0, outMsg, cause); 47 assertTrue(ex.getMessage().startsWith(outMsg)); 48 assertTrue(ex.getMessage().indexOf("0") > 0); 49 assertEquals(cause, ex.getCause()); 50 assertEquals(0.0, ex.getArgument(), 0); 51 } 52 } 53 | Popular Tags |