forked from FasterXML/jackson-databind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a failing test for the issue FasterXML#1456
- Loading branch information
1 parent
8771ed4
commit 3dd4086
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/test/java/com/fasterxml/jackson/failing/GenericParameterTypeFactory1456Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |