Best way to delay/pause workflow execution for testing

You can make queries from the mocked activities. This way you can verify that at the point that activity is invoked the query returns the expected value. Here is the code that worked for me:

  @Test
  public void testMockedActivity() {
    String id = "id1";
    GreetingActivities activities = mock(GreetingActivities.class);
    when(activities.composeGreeting("Hello", "World"))
        .thenAnswer(
            (invocation) -> {
              String queryResult = client.newWorkflowStub(GreetingWorkflow.class, id).query1();
              assertEquals("queryResult1", queryResult);
              return "Hello World!";
            });
    worker.registerActivitiesImplementations(activities);
    testEnv.start();

    // Get a workflow stub using the same task queue the worker uses.
    GreetingWorkflow workflow =
        client.newWorkflowStub(
            GreetingWorkflow.class,
            WorkflowOptions.newBuilder().setWorkflowId(id).setTaskQueue(TASK_QUEUE).build());
    // Execute a workflow waiting for it to complete.
    String greeting = workflow.getGreeting("World");
    assertEquals("Hello World!", greeting);
  }

Also, you can always call testEnv.sleep to move forward to some time in the workflow future.