### Question:
ModelPostProcessor { <T> void processAfterMapping(ResourceModelMetaData metaData, T model) { if (metaData == null) { throw new IllegalArgumentException("Method argument metaData must not be null."); } if (model == null) { throw new IllegalArgumentException("Method argument model must not be null."); } for (MethodMetaData methodMetaData : metaData.getAfterMappingMethods()) { Method method = methodMetaData.getMethod(); makeAccessible(method); try { method.invoke(model); } catch (InvocationTargetException | SecurityException e) { logger.error("Unable to invoke the @" + AfterMapping.class.getSimpleName() + " method " + method + ".", e); } catch (IllegalAccessException e) { throw new IllegalStateException("It must not be illegal to access " + method + ".", e); } } }    }### Answer:
@Test(expected = IllegalArgumentException.class) public void testProcessAfterMappingRequiresNonNullMetaData() { this.testee.processAfterMapping(null, this.model); }
@Test(expected = IllegalArgumentException.class) public void testProcessAfterMappingRequiresNonNullModel() { this.testee.processAfterMapping(this.metadata, null); }
@Test public void testAfterMapping() { withModel(new TestModel()); processAfterMapping(); assertAfterMappingMethodsAreInvoked(); }
@Test public void testHandlingOfExceptionDuringAfterMappingPhase() { withModel(new TestModel()); withExceptionDuringAfterMappingMethodInvocation(); processAfterMapping(); }