Skip to content

Commit

Permalink
Provide a failing test for the issue FasterXML#1456
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikhalskiy committed Nov 16, 2016
1 parent 8771ed4 commit 3dd4086
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.fasterxml.jackson.failing;


import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;

import java.lang.reflect.Method;
import java.lang.reflect.Type;

import static org.junit.Assert.assertEquals;

public class GenericParameterTypeFactory1456Test {
public static class BaseController<Entity extends BaseEntity> {
public void process(Entity entity) {}
}

public static class ImplController extends BaseController<ImplEntity> {}

public static class BaseEntity {}

public static class ImplEntity extends BaseEntity {}

@Test
public void test() throws NoSuchMethodException {
Method proceed = BaseController.class.getMethod("proceed", BaseEntity.class);
Type entityType = proceed.getGenericParameterTypes()[0];

JavaType resolvedType = new ObjectMapper().getTypeFactory().constructType(entityType, ImplController.class);
assertEquals(ImplEntity.class, resolvedType.getRawClass());
}
}

0 comments on commit 3dd4086

Please sign in to comment.