@Test
public void whenGetPageDataShouldReturnPageBean() throws ItemNotFoundException {

    item.setState(new PercentType(50));
    configureItemUIRegistry(item.getState(), OnOffType.ON);
    // Disable long polling
    when(headers.getRequestHeader(HTTP_HEADER_X_ATMOSPHERE_TRANSPORT)).thenReturn(null);
    Response response = sitemapResource.getPageData(headers, null, SITEMAP_MODEL_NAME, SITEMAP_NAME, null, false);
    PageDTO pageDTO = (PageDTO) response.getEntity();
    assertThat(pageDTO.id, is(SITEMAP_NAME));
    assertThat(pageDTO.title, is(SITEMAP_TITLE));
    assertThat(pageDTO.leaf, is(true));
    assertThat(pageDTO.timeout, is(false));
    assertThat(pageDTO.widgets, notNullValue());
    assertThat((Collection<?>) pageDTO.widgets, hasSize(2));
    assertThat(pageDTO.widgets.get(0).widgetId, is(WIDGET1_ID));
    assertThat(pageDTO.widgets.get(0).label, is(WIDGET1_LABEL));
    assertThat(pageDTO.widgets.get(0).labelcolor, is("GREEN"));
    assertThat(pageDTO.widgets.get(0).valuecolor, is("BLUE"));
    assertThat(pageDTO.widgets.get(0).state, nullValue());
    assertThat(pageDTO.widgets.get(0).item, notNullValue());
    assertThat(pageDTO.widgets.get(0).item.name, is(ITEM_NAME));
    assertThat(pageDTO.widgets.get(0).item.state, is("50"));
    assertThat(pageDTO.widgets.get(1).widgetId, is(WIDGET2_ID));
    assertThat(pageDTO.widgets.get(1).label, is(WIDGET2_LABEL));
    assertThat(pageDTO.widgets.get(1).labelcolor, nullValue());
    assertThat(pageDTO.widgets.get(1).valuecolor, nullValue());
    assertThat(pageDTO.widgets.get(1).state, is("ON"));
    assertThat(pageDTO.widgets.get(1).item, notNullValue());
    assertThat(pageDTO.widgets.get(1).item.name, is(ITEM_NAME));
    assertThat(pageDTO.widgets.get(1).item.state, is("50"));
}