1 16 package net.sf.cglib.beans; 17 18 import java.lang.reflect.Method ; 19 import junit.framework.*; 20 21 25 public class TestImmutableBean extends TestCase { 26 27 public void testSimple() { 28 MA bean = new MA(); 29 assertTrue(bean.getIntP() == 0); 30 bean.setIntP(42); 31 assertTrue(bean.getIntP() == 42); 32 bean = (MA)ImmutableBean.create(bean); 33 assertTrue(bean.getIntP() == 42); 34 try { 35 bean.setIntP(43); 36 fail("expecting illegal state exception"); 37 } catch (IllegalStateException ignore) { } 38 } 39 40 public TestImmutableBean(java.lang.String testName) { 41 super(testName); 42 } 43 44 public static void main(java.lang.String [] args) { 45 junit.textui.TestRunner.run(suite()); 46 } 47 48 public static Test suite() { 49 return new TestSuite(TestImmutableBean.class); 50 } 51 } 52 | Popular Tags |