Tabnine Logo
BeanJsonConverterTest
Code IndexAdd Tabnine to your IDE (free)

How to use
BeanJsonConverterTest
in
org.apache.shindig.protocol.conversion

Best Java code snippets using org.apache.shindig.protocol.conversion.BeanJsonConverterTest (Showing top 20 results out of 315)

origin: apache/shindig

@Test
public void testJsonToObject() throws Exception {
 String json = '{' +
   "hello:'world'," +
   "count:10," +
   "someStatic:'foo'," +
   "testEnum:'bar'," +
   "children:[{hello:'world-2',count:11},{hello:'world-3',count:12}]}";
 TestObject object = beanJsonConverter.convertToObject(json, TestObject.class);
 assertEquals("world", object.hello);
 assertEquals(10, object.count);
 assertEquals("world-2", object.children.get(0).hello);
 assertEquals(11, object.children.get(0).count);
 assertEquals("world-3", object.children.get(1).hello);
 assertEquals(12, object.children.get(1).count);
 assertNull("Should not set static values", TestObject.staticValue);
 assertEquals(TestObject.TestEnum.bar, object.testEnum);
}
origin: org.apache.shindig/shindig-common

@Test
public void testJsonToNestedGeneric() throws Exception {
 String jsonActivity = "{key0:[0,1,2],key1:[3,4,5]}";
 Map<String, List<Integer>> data =  beanJsonConverter.convertToObject(jsonActivity,
   new TypeLiteral<Map<String, List<Integer>>>(){}.getType());
 assertEquals(2, data.size());
 assertEquals(Arrays.asList(0, 1, 2), data.get("key0"));
 assertEquals(Arrays.asList(3, 4, 5), data.get("key1"));
}
origin: org.gatein.shindig/shindig-common

 @Test
 public void testEmptyJsonMap() throws Exception {
  String emptyMap = "{}";
  Map<String, String> data = beanJsonConverter.convertToObject(emptyMap, 
     new TypeLiteral<Map<String,String>>(){}.getType());
  assertTrue(data.isEmpty());
 }
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testJsonToPrimitives() throws Exception {
 String simpleJson = "{hello:'world',count:10}";
 Object object = beanJsonConverter.convertToObject(simpleJson, null);
 Map<?, ?> map = (Map<?, ?>) object;
 assertEquals("world", map.get("hello"));
 assertEquals(10, map.get("count"));
}
origin: apache/shindig

@Test
public void testEmptyJsonMap() throws Exception {
 String emptyMap = "{}";
 Map<String, String> data = beanJsonConverter.convertToObject(emptyMap,
    new TypeLiteral<Map<String,String>>(){}.getType());
 assertTrue(data.isEmpty());
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testJsonToObject() throws Exception {
 String json = '{' +
   "hello:'world'," +
   "count:10," +
   "someStatic:'foo'," +
   "testEnum:'bar'," +
   "children:[{hello:'world-2',count:11},{hello:'world-3',count:12}]}";
 TestObject object = beanJsonConverter.convertToObject(json, TestObject.class);
 assertEquals("world", object.hello);
 assertEquals(10, object.count);
 assertEquals("world-2", object.children.get(0).hello);
 assertEquals(11, object.children.get(0).count);
 assertEquals("world-3", object.children.get(1).hello);
 assertEquals(12, object.children.get(1).count);
 assertNull("Should not set static values", TestObject.staticValue);
 assertEquals(TestObject.TestEnum.bar, object.testEnum);
}
origin: com.lmco.shindig/shindig-common

@Test
public void testJsonToNestedGeneric() throws Exception {
 String jsonActivity = "{key0:[0,1,2],key1:[3,4,5]}";
 Map<String, List<Integer>> data =  beanJsonConverter.convertToObject(jsonActivity,
   new TypeLiteral<Map<String, List<Integer>>>(){}.getType());
 assertEquals(2, data.size());
 assertEquals(Arrays.asList(0, 1, 2), data.get("key0"));
 assertEquals(Arrays.asList(3, 4, 5), data.get("key1"));
}
origin: com.lmco.shindig/shindig-common

 @Test
 public void testEmptyJsonMap() throws Exception {
  String emptyMap = "{}";
  Map<String, String> data = beanJsonConverter.convertToObject(emptyMap, 
     new TypeLiteral<Map<String,String>>(){}.getType());
  assertTrue(data.isEmpty());
 }
}
origin: com.lmco.shindig/shindig-common

@Test
public void testJsonToObject() throws Exception {
 String json = '{' +
   "hello:'world'," +
   "count:10," +
   "someStatic:'foo'," +
   "testEnum:'bar'," +
   "children:[{hello:'world-2',count:11},{hello:'world-3',count:12}]}";
 TestObject object = beanJsonConverter.convertToObject(json, TestObject.class);
 assertEquals("world", object.hello);
 assertEquals(10, object.count);
 assertEquals("world-2", object.children.get(0).hello);
 assertEquals(11, object.children.get(0).count);
 assertEquals("world-3", object.children.get(1).hello);
 assertEquals(12, object.children.get(1).count);
 assertNull("Should not set static values", TestObject.staticValue);
 assertEquals(TestObject.TestEnum.bar, object.testEnum);
}
origin: org.gatein.shindig/shindig-common

@Test
public void testJsonToNestedGeneric() throws Exception {
 String jsonActivity = "{key0:[0,1,2],key1:[3,4,5]}";
 Map<String, List<Integer>> data =  beanJsonConverter.convertToObject(jsonActivity,
   new TypeLiteral<Map<String, List<Integer>>>(){}.getType());
 assertEquals(2, data.size());
 assertEquals(Arrays.asList(0, 1, 2), data.get("key0"));
 assertEquals(Arrays.asList(3, 4, 5), data.get("key1"));
}
origin: org.apache.shindig/shindig-common

@Test
public void testEmptyJsonMap() throws Exception {
 String emptyMap = "{}";
 Map<String, String> data = beanJsonConverter.convertToObject(emptyMap,
    new TypeLiteral<Map<String,String>>(){}.getType());
 assertTrue(data.isEmpty());
}
origin: org.apache.shindig/shindig-common

@Test
public void testJsonToObject() throws Exception {
 String json = '{' +
   "hello:'world'," +
   "count:10," +
   "someStatic:'foo'," +
   "testEnum:'bar'," +
   "children:[{hello:'world-2',count:11},{hello:'world-3',count:12}]}";
 TestObject object = beanJsonConverter.convertToObject(json, TestObject.class);
 assertEquals("world", object.hello);
 assertEquals(10, object.count);
 assertEquals("world-2", object.children.get(0).hello);
 assertEquals(11, object.children.get(0).count);
 assertEquals("world-3", object.children.get(1).hello);
 assertEquals(12, object.children.get(1).count);
 assertNull("Should not set static values", TestObject.staticValue);
 assertEquals(TestObject.TestEnum.bar, object.testEnum);
}
origin: org.apache.shindig/shindig-common

@Test
public void testJsonToPrimitives() throws Exception {
 String simpleJson = "{hello:'world',count:10}";
 Object object = beanJsonConverter.convertToObject(simpleJson, null);
 Map<?, ?> map = (Map<?, ?>) object;
 assertEquals("world", map.get("hello"));
 assertEquals(10, map.get("count"));
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testEmptyJsonMap() throws Exception {
 String emptyMap = "{}";
 Map<String, String> data = beanJsonConverter.convertToObject(emptyMap,
    new TypeLiteral<Map<String,String>>(){}.getType());
 assertTrue(data.isEmpty());
}
origin: org.gatein.shindig/shindig-common

@Test
public void testJsonToObject() throws Exception {
 String json = '{' +
   "hello:'world'," +
   "count:10," +
   "someStatic:'foo'," +
   "testEnum:'bar'," +
   "children:[{hello:'world-2',count:11},{hello:'world-3',count:12}]}";
 TestObject object = beanJsonConverter.convertToObject(json, TestObject.class);
 assertEquals("world", object.hello);
 assertEquals(10, object.count);
 assertEquals("world-2", object.children.get(0).hello);
 assertEquals(11, object.children.get(0).count);
 assertEquals("world-3", object.children.get(1).hello);
 assertEquals(12, object.children.get(1).count);
 assertNull("Should not set static values", TestObject.staticValue);
 assertEquals(TestObject.TestEnum.bar, object.testEnum);
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testJsonToNestedGeneric() throws Exception {
 String jsonActivity = "{key0:[0,1,2],key1:[3,4,5]}";
 Map<String, List<Integer>> data =  beanJsonConverter.convertToObject(jsonActivity,
   new TypeLiteral<Map<String, List<Integer>>>(){}.getType());
 assertEquals(2, data.size());
 assertEquals(Arrays.asList(0, 1, 2), data.get("key0"));
 assertEquals(Arrays.asList(3, 4, 5), data.get("key1"));
}
origin: org.apache.shindig/shindig-common

@Test
public void testEmptyExtendableBean() throws Exception {
 String emptyMap = "{}";
 ExtendableTestObject data = beanJsonConverter.convertToObject(emptyMap,
    ExtendableTestObject.class);
 assertTrue(data.isEmpty());
}
origin: org.apache.shindig/shindig-common

 @Test
 public void testGetPropertyNameOfBridgeMethod() throws NoSuchMethodException, SecurityException {
  Method bridgeSetter = GenericObject.class.getMethod("setT", Object.class);
  assertNull(BeanJsonConverter.getPropertyName(bridgeSetter));
  Method realSetter = GenericObject.class.getMethod("setT", String.class);;
  assertEquals("t", BeanJsonConverter.getPropertyName(realSetter));
 }
}
origin: com.lmco.shindig/shindig-common

@Test
public void testJsonToPrimitives() throws Exception {
 String simpleJson = "{hello:'world',count:10}";
 Object object = beanJsonConverter.convertToObject(simpleJson, null);
 Map<?, ?> map = (Map<?, ?>) object;
 assertEquals("world", map.get("hello"));
 assertEquals(10, map.get("count"));
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testEmptyExtendableBean() throws Exception {
 String emptyMap = "{}";
 ExtendableTestObject data = beanJsonConverter.convertToObject(emptyMap,
    ExtendableTestObject.class);
 assertTrue(data.isEmpty());
}
org.apache.shindig.protocol.conversionBeanJsonConverterTest

Most used methods

  • assertEquals
  • assertNull
  • assertTrue

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Permission (java.security)
    Legacy security code; do not use.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now