@Test public void testUnwrapToInterfaceTypesSucceeds() { Context context = new MessageInterpolatorContext(null, null, null, Collections.<String, Object>emptyMap()); MessageInterpolator.Context asMessageInterpolatorContext = context.unwrap(MessageInterpolator.Context.class); assertSame(asMessageInterpolatorContext, context); HibernateMessageInterpolatorContext asHibernateMessageInterpolatorContext = context.unwrap(HibernateMessageInterpolatorContext.class); assertSame(asHibernateMessageInterpolatorContext, context); Object asObject = context.unwrap(Object.class); assertSame(asObject, context); }
@Test(expectedExceptions = ValidationException.class) public void testUnwrapToImplementationCausesValidationException() { Context context = new MessageInterpolatorContext(null, null, null, Collections.<String, Object>emptyMap()); context.unwrap(MessageInterpolatorContext.class); }