QueryImpl extends AbstractQuery implements Query { @Override public Query setMaxResults(int maxResults) { ensureOpen(); checkNumericParameter(maxResults, "max results"); query.setMaxResults(maxResults); return this; } QueryImpl(final QueryHolder query, final ConnectionWrapper connection); @Override List getResultList(); @Override Object getSingleResult(); @Override Stream getResultStream(); @Override Query setMaxResults(int maxResults); @Override Query setFirstResult(int startPosition);  }
@Test void exceptionInSetMaxResultsInvokesRollbackMarker() { final QueryImpl q = queryWithRollbackMarker(SELECT_QUERY); try { q.setMaxResults(-1); } catch (RuntimeException e) { } verify(handler).execute(); }