@Test
public void testMessagePOST() {
WicketTester tester = new WicketTester();
ApplicationContextMock appctx = new ApplicationContextMock();
//TODO: eliminate dependency to DOJO configuration!
appctx.putBean(mock(DOJOConfiguration.class));
appctx.putBean(mock(SessionDataContainer.class));
EventsDispatcher eventsDispatcher = mock(EventsDispatcher.class);
appctx.putBean(eventsDispatcher);
appctx.putBean(mock(AuthorizedUserService.class));
appctx.putBean(mock(UserReaderFactory.class));
appctx.putBean(mock(LocaleService.class));
appctx.putBean(mock(MenuService.class));
appctx.putBean(mock(TargetLinkFactory.class));
appctx.putBean(mock(TargetKeyFactory.class));
WicketConfiguration wicketConfiguration = mock(WicketConfiguration.class);
when(wicketConfiguration.getItemsPerPage()).thenReturn(10);
appctx.putBean(wicketConfiguration);
appctx.putBean(mock(PagePreprocessorsRegistry.class));
appctx.putBean(mock(BreadcrumbInfoAccessor.class));
appctx.putBean(mock(BreadcrumbsStore.class));
MessageReader messageReader = mock(MessageReader.class);
when(messageReader.getUserMessages(Mockito.<Integer>any(), Mockito.<SortDescriptor>any())).thenReturn(new EmptyDataSet<Message>(Message.class));
appctx.putBean(messageReader);
appctx.putBean(mock(MessageWriter.class));
appctx.putBean(mock(RepresentationFactory.class));
tester.getApplication().getComponentInstantiationListeners().add(
new SpringComponentInjector(tester.getApplication(), appctx));