### Question:
QueuedVCatRenderer implements IVCatRenderer<W> { @Override public RenderedFileInfo render(final AbstractAllParams<W> all) throws VCatException { final String jobId = HashHelper.sha256Hex(all.getCombined()); Object lock; synchronized (this.jobs) { if (this.jobs.containsKey(jobId)) { this.jobs.put(jobId, this.jobs.get(jobId) + 1); LOGGER.info(() -> String.format(Messages.getString("QueuedVCatRenderer.Info.AlreadyScheduled"), jobId)); lock = jobLocks.get(jobId); } else { this.jobs.put(jobId, 1); lock = new Object(); this.jobLocks.put(jobId, lock); this.executorService.execute(() -> runJob(jobId, all)); LOGGER.info(() -> String.format(Messages.getString("QueuedVCatRenderer.Info.Scheduled"), jobId)); } } synchronized (lock) { while (!this.jobsFinished.containsKey(jobId)) { try { lock.wait(); } catch (InterruptedException e) { } } } synchronized (this.jobs) { Exception e = this.jobExceptions.get(jobId); RenderedFileInfo renderedFileInfo = this.jobsFinished.get(jobId); final int waiting = this.jobs.get(jobId); if (waiting > 1) { this.jobs.put(jobId, waiting - 1); } else { this.jobs.remove(jobId); this.jobsFinished.remove(jobId); this.jobLocks.remove(jobId); this.jobExceptions.remove(jobId); } if (e != null) { throw new VCatException(Messages.getString("QueuedVCatRenderer.Exception.Graphviz"), e); } return renderedFileInfo; } } QueuedVCatRenderer(final IVCatRenderer<W> otherRenderer, final int numberOfThreads); int getNumberOfQueuedJobs(); @Override RenderedFileInfo render(final AbstractAllParams<W> all);  }### Answer:
@Test public void testRender() throws VCatException { TestAllParams params = new TestAllParams(); underTest.render(params); assertEquals(1, testRenderer.getCreatedGraphFiles().size()); assertEquals(1, testRenderer.getRenderedFileFromGraphFiles().size()); }
@Test public void testRenderConcurrent() throws VCatException { testRenderer.setDelay(1000); TestAllParams params = new TestAllParams(); for (int i = 0; i < 99; i++) { new Thread(() -> { try { underTest.render(params); assertEquals(1, testRenderer.getCreatedGraphFiles().size()); assertEquals(1, testRenderer.getRenderedFileFromGraphFiles().size()); } catch (VCatException e) { throw new RuntimeException(e); } }).start(); } underTest.render(params); assertEquals(1, testRenderer.getCreatedGraphFiles().size()); assertEquals(1, testRenderer.getRenderedFileFromGraphFiles().size()); }