int totalSize = 50;
int pageCount = 2;
int pageSize = totalSize / pageCount;
JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
PageRequest pageRequest = new PageRequest("1", pageSize);
PersistedObjectsFactory.preparePrivateMessages(totalSize, userTo, userFrom);
Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);
assertEquals(messagePage.getContent().size(), pageSize, "Incorrect count of message in one page.");