### Question:
PrivateMessageRepository { public List<PrivateMessageProjection> getHistory(UUID me, String companion, int page, int count) { return ebeanServer.findDto(PrivateMessageProjection.class, "select " + "sender.name f, receiver.name t, m.text, m.date " + "from private_message_record m" + " inner join players sender on sender.id = m.from_id" + " inner join players receiver on receiver.id = m.to_id" + " where " + "sender.uuid = :me" + " and receiver.name = :companion" + " or" + " sender.name = :companion " + " and receiver.uuid = :me" + " order by date") .setParameter("me", me) .setParameter("companion", companion) .setMaxRows(count) .setFirstRow(page * count) .findList(); }  void save(PrivateMessageRecord privateMessageRecord); List<PrivateMessageProjection> getHistory(UUID me, String companion, int page, int count);  }### Answer:
@Test public void getHistory() { List<PlayerProfile> profiles = createProfiles(); for (int i = 0; i < 10; i++) { PrivateMessageRecord record = new PrivateMessageRecord( profiles.get(0), profiles.get(1), "text-" + i ); repository.save(record); } PrivateMessageRecord aC = new PrivateMessageRecord(profiles.get(0), profiles.get(2), "a to c"); PrivateMessageRecord bC = new PrivateMessageRecord(profiles.get(1), profiles.get(2), "a to c"); repository.save(aC); repository.save(bC); final List<PrivateMessageProjection> history = repository.getHistory(profiles.get(0).getUuid(), profiles.get(1).getName(), 0, 10); assertEquals(10, history.size()); history.sort(Comparator.comparing(PrivateMessageProjection::getText)); for (int i = 0; i < history.size(); i++) { final PrivateMessageProjection privateMessageProjection = history.get(i); assertEquals("text-" + i, privateMessageProjection.getText()); } }