1 18 19 package org.apache.commons.math.analysis; 20 21 import org.apache.commons.math.ConvergenceException; 22 23 import junit.framework.TestCase; 24 25 28 public class ConvergenceExceptionTest extends TestCase { 29 32 public void testConstructor(){ 33 ConvergenceException ex = new ConvergenceException(); 34 assertNull(ex.getCause()); 35 assertNull(ex.getMessage()); 36 } 37 38 41 public void testConstructorMessage(){ 42 String msg = "message"; 43 ConvergenceException ex = new ConvergenceException(msg); 44 assertNull(ex.getCause()); 45 assertEquals(msg, ex.getMessage()); 46 } 47 48 51 public void testConstructorMessageCause(){ 52 String outMsg = "outer message"; 53 String inMsg = "inner message"; 54 Exception cause = new Exception (inMsg); 55 ConvergenceException ex = new ConvergenceException(outMsg, cause); 56 assertEquals(outMsg, ex.getMessage()); 57 assertEquals(cause, ex.getCause()); 58 } 59 60 63 public void testConstructorCause(){ 64 String inMsg = "inner message"; 65 Exception cause = new Exception (inMsg); 66 ConvergenceException ex = new ConvergenceException(cause); 67 assertEquals(cause, ex.getCause()); 68 } 69 } 70 | Popular Tags |