@Test public void maxPages() throws Exception { TestRepository<Repo> repo = createProject("repo"); Change change = newChange(repo, null, null, null, null).insert(); QueryRequest query = newQuery("status:new").withLimit(10); assertQuery(query, change); assertQuery(query.withStart(1)); assertQuery(query.withStart(99)); assertBadQuery(query.withStart(100)); assertQuery(query.withLimit(100).withStart(100)); }
protected List<ChangeInfo> assertQuery(QueryRequest query, Change... changes) throws Exception { List<ChangeInfo> result = query.get(); Iterable<Integer> ids = ids(result); assertThat(ids).named(query.getQuery()).containsExactlyElementsIn(ids(changes)).inOrder(); return result; }
protected void assertBadQuery(QueryRequest query) throws Exception { exception.expect(BadRequestException.class); query.get(); }