
package com.fasterxml.jackson.databind.module;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.customenumkey.TestEnum;
import com.fasterxml.jackson.databind.module.customenumkey.TestEnumModule;
import com.google.common.io.Resources;
import org.junit.Test;

import java.io.File;
import java.util.Map;
import java.util.Set;

import static junit.framework.TestCase.assertNotNull;

/**
 *
 */
public class TestCustomKeyDeserializer {
    @Test
    public void troubleWithKeys() throws Exception {
        ObjectMapper plainObjectMapper = new ObjectMapper();
        JsonNode tree = plainObjectMapper.readTree(Resources.getResource("data/enum-custom-key-test.json"));
        ObjectMapper fancyObjectMapper = TestEnumModule.setupObjectMapper(new ObjectMapper());
        // this line is might throw with Jackson 2.6.2.
        Map<TestEnum, Set<String>> map = fancyObjectMapper.convertValue(tree, new TypeReference<Map<TestEnum, Set<String>>>() {});
        assertNotNull(map);
    }
}

@@ -196,16 +196,84 @@
 Mapper;%0A
+import com.fasterxml.jackson.databind.module.customenumkey.KeyEnum;%0A
 import c
@@ -404,24 +404,118 @@
 EnumModule;%0A
+import com.fasterxml.jackson.databind.node.ObjectNode;%0Aimport com.google.common.collect.Maps;%0A
 import com.g
@@ -541,16 +541,41 @@
 ources;%0A
+import org.junit.Ignore;%0A
 import o
@@ -607,24 +607,52 @@
 va.io.File;%0A
+import java.io.IOException;%0A
 import java.
@@ -737,16 +737,61 @@
 NotNull;
+%0Aimport static org.junit.Assert.assertEquals;
 %0A%0A/**%0A *
@@ -1347,16 +1347,25 @@
 g%3E%3E%3E() %7B
+%0A        
 %7D);%0A    
@@ -1393,11 +1393,772 @@
 );%0A    %7D
+%0A%0A    @Ignore(%22issue 749, more or less%22)%0A    @Test%0A    public void tree() throws Exception %7B%0A%0A        Map%3CKeyEnum, Object%3E inputMap = Maps.newHashMap();%0A        Map%3CTestEnum, Map%3CString, String%3E%3E replacements = Maps.newHashMap();%0A        Map%3CString, String%3E reps = Maps.newHashMap();%0A        reps.put(%221%22, %22one%22);%0A        replacements.put(TestEnum.GREEN, reps);%0A        inputMap.put(KeyEnum.replacements, replacements);%0A        ObjectMapper mapper = TestEnumModule.setupObjectMapper(new ObjectMapper());%0A        JsonNode tree = mapper.valueToTree(inputMap);%0A        ObjectNode ob = (ObjectNode) tree;%0A        JsonNode inner = ob.get(%22replacements%22);%0A        String firstFieldName = inner.fieldNames().next();%0A        assertEquals(%22green%22, firstFieldName);%0A    %7D
 %0A%7D%0A

Add a test case for 749.