@Test
public void testFindExecutionsWithPaging() {

    if (!TestEnvironment.canRunTest(ConfigOption.RUN_JOBS)) {
        System.err.println("Skipping test that would run jobs");
        return;
    }
    DXApplet applet = createMinimalApplet();
    // A sample input: {input_string: "java"}
    SampleAppInput appInput = new SampleAppInput("java");
    // Instantiate to create a bunch of jobs, and save them
    List<DXJob> jobs = Lists.newArrayList();
    for (int i = 0; i < 8; ++i) {
        jobs.add(applet.newRun().setInput(appInput).setProject(testProject)
                .setName("javaFindExecutionsPagingTest").run());
    }
    // Set a small page size
    assertEqualsAnyOrder(
            DXSearch.findExecutions().inProject(testProject)
                    .nameMatchesExactly("javaFindExecutionsPagingTest").execute(3),
            jobs.toArray(new DXJob[0]));
    // Page size is a multiple of the number of results
    assertEqualsAnyOrder(
            DXSearch.findExecutions().inProject(testProject)
                    .nameMatchesExactly("javaFindExecutionsPagingTest").execute(4),
            jobs.toArray(new DXJob[0]));
}