PageUserImpl subMember = new PageUserImpl();
subPage1.setMembers(Lists.<PageUser>newLinkedList());
subPage1.setRegions(Lists.<Region>newLinkedList());
subPage1.getMembers().add(subMember);
subPage1.getRegions().add(subRegion);
Page subPage2 = new PageImpl();
subPage2.setMembers(Lists.<PageUser>newLinkedList());
subPage2.setRegions(Lists.<Region>newLinkedList());
page.getSubPages().add(subPage1);
page.getSubPages().add(subPage2);
PageLayout pageLayout = new PageLayoutImpl();
pageLayout.setCode("asdf");
page.setPageLayoutCode(pageLayout.getCode());
expect(pageLayoutRepository.getByPageLayoutCode(page.getPageLayoutCode())).andReturn(pageLayout);
replay(pageLayoutRepository);
converter.hydrate(page);
assertThat(page.getPageLayout(), is(sameInstance(pageLayout)));
assertThat(page.getMembers().get(0), is(instanceOf(PageUserImpl.class)));
assertThat((MongoDbPage)region1.getPage(), is(sameInstance(page)));
assertThat((MongoDbPage)subPage1.getParentPage(), is(sameInstance(page)));
assertThat((MongoDbPage)subPage2.getParentPage(), is(sameInstance(page)));
assertThat(page.getRegions().get(0).getRegionWidgets().get(0), is(sameInstance(rw1)));
}//end hydratePage_valid