jackson mapping fix

This commit is contained in:
eugenp 2014-02-25 00:27:46 +02:00
parent 528ef210e4
commit 06b521b4ee
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ public class ItemDeserializer extends JsonDeserializer<Item> {
final JsonNode node = jp.getCodec().readTree(jp);
final int id = (Integer) ((IntNode) node.get("id")).numberValue();
final String itemName = node.get("itemName").asText();
final int userId = (Integer) ((IntNode) node.get("owner")).numberValue();
final int userId = (Integer) ((IntNode) node.get("createdBy")).numberValue();
return new Item(id, itemName, new User(userId, null));
}

View File

@ -146,7 +146,7 @@ public class JacksonDeserializationUnitTest {
@Test
public final void whenDeserializingANonStandardRepresentation_thenCorrect() throws JsonParseException, JsonMappingException, IOException {
final String json = "{\"id\":1,\"itemName\":\"theItem\",\"owner\":2}";
final String json = "{\"id\":1,\"itemName\":\"theItem\",\"createdBy\":2}";
final ObjectMapper mapper = new ObjectMapper();
final SimpleModule module = new SimpleModule();