1 4 package org.oddjob.monitor.model; 5 6 import java.util.HashMap ; 7 import java.util.Map ; 8 9 import junit.framework.TestCase; 10 11 import org.oddjob.framework.WrapDynaBean; 12 13 public class DescriberTest extends TestCase { 14 15 public static class O1 { 16 public Map describe() { 17 Map map = new HashMap (); 18 map.put("fruit", "apples"); 19 return map; 20 } 21 } 22 23 public void test1() { 24 Map d = Describer.describe(new O1()); 25 assertEquals("apples", d.get("fruit")); 26 } 27 28 public static class O2 { 29 public String getFruit() { 30 return "apples"; 31 } 32 } 33 34 public void test2() { 35 Map d = Describer.describe(new O2()); 36 assertEquals("apples", d.get("fruit")); 37 } 38 39 public static class O3 { 40 public void setFruit(String fruit) { 41 } 42 } 43 44 48 public void testDynaBean() { 49 WrapDynaBean wrap = new WrapDynaBean(new O3()); 50 Map d = Describer.describe(wrap); 51 assertEquals(1, d.size()); 53 } 54 55 } 56 | Popular Tags |