コード例 #1
0
 // not able to read hashmap data
 public void testObjectInMapList() {
   List list = new ArrayList();
   Map data = new HashMap<String, DummyPerson>();
   data.put("person1", new DummyPerson("Hallo", "Khaznadar"));
   list.add(data);
   Object result = ObjectMapConverter.convert(list);
   System.err.println(result);
 }
コード例 #2
0
  public void testSomeObject() {
    SomeObject so = new SomeObject("nene");
    so.toString();

    Object outcome = ObjectMapConverter.convert(so);
    System.out.println(outcome);
    //		assertTrue(!SomeOtherObject.class.equals(outcome.get("soo").getClass()));

  }
コード例 #3
0
 public void testMap() {
   Map<String, String> map = new HashMap<String, String>();
   map.put("key", "jaja");
   ObjectMapConverter.convert(map);
 }
コード例 #4
0
 public void testString() {
   String jaja = "jaja";
   Object obj = ObjectMapConverter.convert(jaja);
   assertNull(obj);
 }
コード例 #5
0
 public void testObject() {
   Object s = ObjectMapConverter.convert(new Object());
   if (s instanceof Map) {
     assertTrue(((Map) s).isEmpty());
   }
 }
コード例 #6
0
 public void testNull() {
   Object map = ObjectMapConverter.convert(null);
   assertNull(map);
 }
コード例 #7
0
 //	public void testObjectInMap(){
 //		Map map = new HashMap();
 //		TestObject object = new TestObject("superString", "aString", new Integer(1), 1234);
 //		map.put("key", object);
 //		map = ObjectToMapConverter.convert(map);
 //		assertEquals("superString", (((Map)map.get("key")).get("aSuperString")));
 //		assertEquals("aString", (((Map)map.get("key")).get("aString")));
 //		assertEquals(new Integer(1), (((Map)map.get("key")).get("aInteger")));
 //		assertEquals(1234, ((Integer)(((Map)map.get("key")).get("aInt"))).intValue());
 //	}
 public void testNullInMap() {
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("key", null);
   Object o = ObjectMapConverter.convert(map);
   if (o instanceof Map) assertNull(((Map) o).get("key"));
 }