@Test
public void testCreateAttributeMapfail() {

    // set up
    int page = 1;
    int size = 1;
    Sort sort = mock(Sort.class);
    @SuppressWarnings("unchecked")
    Iterator<Order> orders = mock(Iterator.class);
    when(sort.iterator()).thenReturn(orders);
    when(orders.hasNext()).thenReturn(false);
    // run
    Map<String, Object> attributesMap = PaginationInfo.createAttributeMap(
            page, size, sort);
    // assert
    assertThat(Integer.valueOf(attributesMap.get("page").toString()), is(
            page));
    assertThat(Integer.valueOf(attributesMap.get("size").toString()), is(
            size));
    assertThat(attributesMap.get("sortOrderProperty"), is(nullValue()));
    assertThat(attributesMap.get("sortOrderDirection"), is(nullValue()));
}