Package org.apache.shindig.social.core.util

Examples of org.apache.shindig.social.core.util.JsonObjectToMapMorpher


   * Test method for
   * {@link org.apache.shindig.social.core.util.JsonObjectToMapMorpher#morphsTo()}.
   */
  @Test
  public void testMorphsTo() {
    Morpher m = new JsonObjectToMapMorpher();
    assertEquals(Map.class, m.morphsTo());
  }
View Full Code Here


   * Test method for
   * {@link org.apache.shindig.social.core.util.JsonObjectToMapMorpher#supports(java.lang.Class)}.
   */
  @Test
  public void testSupports() {
    Morpher m = new JsonObjectToMapMorpher();
    assertTrue(m.supports(JSONObject.class));
    assertFalse(m.supports(JSON.class));
    assertFalse(m.supports(List.class));
  }
View Full Code Here

   * Test method for
   * {@link org.apache.shindig.social.core.util.JsonObjectToMapMorpher#morph(java.lang.Object)}.
   */
  @Test
  public void testMorph() {
    ObjectMorpher om = new JsonObjectToMapMorpher();
    JSONObject testObj = new JSONObject();
    testObj.put("x", "y");
    testObj.put("1", "z");
    Object o = om.morph(testObj);
    assertNotSame(testObj, o);
    if (o instanceof Map) {
      Map<?, ?> fm = (Map<?, ?>) o;
      assertEquals("y", fm.get("x"));
      assertEquals("z", fm.get("1"));
      assertNull(fm.get("xyz"));
    }
    try {
      om.morph(o);
      fail();
    } catch (ClassCastException cce) {
      assertTrue(true);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.core.util.JsonObjectToMapMorpher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.