* @throws Exception if the test fails
*/
@Test
public void testHandleNullPostDataKeys() throws Exception {
String path = "/appdata/john.doe/@self/appId";
RestHandler operation = registry.getRestHandler(path, "POST");
String jsonAppData = "{pandas: 'are fuzzy'}";
Map<String, String[]> params = Maps.newHashMap();
params.put("fields", new String[]{"pandas"});
HashMap<String, String> values = Maps.newHashMap();
// create an invalid set of app data and inject
values.put("Aokkey", "an ok key");
values.put("", "an empty value");
org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
.andReturn(values);
replay();
try {
operation.execute(params, new StringReader(jsonAppData), token, converter).get();
fail();
} catch (ExecutionException ee) {
assertEquals(HttpServletResponse.SC_BAD_REQUEST,
((ProtocolException) ee.getCause()).getCode());
// was expecting an Exception