@Test
public void testConcurrency() throws InterruptedException {

    final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS);
    Query q = Builder.create()
            .addFieldClause(
                    "kind",
                    "foo")
            .addFieldClause(
                    "name",
                    "jane")
            .build();
    for (int i = 0; i < 1000; i++) {
        final CountDownLatch start = new CountDownLatch(1);
        final TestContext finish = new TestContext(NUM_THREADS, Duration.ofSeconds(30));
        final JsonMapper mapper = new JsonMapper();
        for (int j = 0; j < NUM_THREADS; j++) {
            executor.execute(() -> {
                try {
                    start.await();
                    mapper.toJson(q);
                    finish.complete();
                } catch (Throwable t) {
                    finish.fail(t);
                }
            });
        }
        start.countDown();
        finish.await();
    }
}