Skip to content

Commit

Permalink
Add test for #609
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 10, 2014
1 parent b7edca6 commit 2657ff3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ public ObjectMapper disable(DeserializationFeature first,
public boolean isEnabled(JsonParser.Feature f) {
return _deserializationConfig.isEnabled(f, _jsonFactory);
}

/**
* Method for changing state of specified {@link com.fasterxml.jackson.core.JsonParser.Feature}s
* for parser instances this object mapper creates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import java.util.*;

import com.fasterxml.jackson.databind.BaseMapTest;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.type.TypeFactory;

/**
Expand Down
36 changes: 36 additions & 0 deletions src/test/java/com/fasterxml/jackson/failing/TestLocalType609.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.fasterxml.jackson.failing;

import com.fasterxml.jackson.databind.*;

/**
* Failing test related to [databind#609]
*/
public class TestLocalType609 extends BaseMapTest
{
static class EntityContainer {
RuleForm entity;

@SuppressWarnings("unchecked")
public <T extends RuleForm> T getEntity() { return (T) entity; }
public <T extends RuleForm> void setEntity(T e) { entity = e; }
}

static class RuleForm {
public int value;

public RuleForm() { }
public RuleForm(int v) { value = v; }
}

public void testLocalPartialType609() throws Exception {
ObjectMapper mapper = new ObjectMapper();

EntityContainer input = new EntityContainer();
input.entity = new RuleForm(12);
String json = mapper.writeValueAsString(input);

EntityContainer output = mapper.readValue(json, EntityContainer.class);
assertEquals(12, output.getEntity().value);
}
}

0 comments on commit 2657ff3

Please sign in to comment.