}
@Test
public void hydratePage_valid() {
MongoDbPage page = new MongoDbPage();
page.setRegions(Lists.<Region>newLinkedList());
Region region1 = new RegionImpl();
Region region2 = new RegionImpl();
region1.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
region2.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
RegionWidget rw1 = new RegionWidgetImpl();
region1.getRegionWidgets().add(rw1);
RegionWidget rw2 = new RegionWidgetImpl();
region2.getRegionWidgets().add(rw2);
page.getRegions().add(region1);
page.getRegions().add(region2);
page.setMembers(Lists.<PageUser>newLinkedList());
PageUserImpl member1 = new PageUserImpl();
PageUser member2 = new PageUserImpl();
page.getMembers().add(member1);
page.getMembers().add(member2);
Region subRegion = new RegionImpl();
subRegion.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
RegionWidget subRegionWidget = new RegionWidgetImpl();
subRegion.getRegionWidgets().add(subRegionWidget);
page.setSubPages(Lists.<Page>newLinkedList());
MongoDbPage subPage1 = new MongoDbPage();
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