Skip to content

Commit 62c0872

Browse files
committed
Add a unit test for #626
1 parent f062a14 commit 62c0872

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/test/java/com/fasterxml/jackson/databind/module/TestSimpleModule.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,21 @@ public void setupModule(SetupContext context)
169169
assertNotNull(m);
170170
}
171171
}
172-
172+
173+
static class TestModule626 extends SimpleModule {
174+
final Class<?> mixin, target;
175+
public TestModule626(Class<?> t, Class<?> m) {
176+
super("Test");
177+
target = t;
178+
mixin = m;
179+
}
180+
181+
@Override
182+
public void setupModule(SetupContext context) {
183+
context.setMixInAnnotations(target, mixin);
184+
}
185+
}
186+
173187
/*
174188
/**********************************************************
175189
/* Unit tests; first, verifying need for custom handlers
@@ -199,13 +213,13 @@ public void testWithoutModule()
199213
verifyException(e, "No suitable constructor found");
200214
}
201215
}
202-
216+
203217
/*
204218
/**********************************************************
205219
/* Unit tests; simple serializers
206220
/**********************************************************
207221
*/
208-
222+
209223
public void testSimpleBeanSerializer() throws Exception
210224
{
211225
ObjectMapper mapper = new ObjectMapper();
@@ -315,5 +329,14 @@ public void testAccessToMapper() throws Exception
315329
ObjectMapper mapper = new ObjectMapper();
316330
mapper.registerModule(module);
317331
}
318-
}
319332

333+
// [databind#626]
334+
public void testMixIns626() throws Exception
335+
{
336+
ObjectMapper mapper = new ObjectMapper();
337+
// no real annotations, but nominally add ones from 'String' to 'Object', just for testing
338+
mapper.registerModule(new TestModule626(Object.class, String.class));
339+
Class<?> found = mapper.findMixInClassFor(Object.class);
340+
assertEquals(String.class, found);
341+
}
342+
}

0 commit comments

Comments
 (0)