@Test
public void testReplaceConcurrent() throws ExecutionException, InterruptedException {

	ExecutorService executorService = Executors.newFixedThreadPool(2);
   	AtomicReference<String> generatedId = new AtomicReference<>("test-0");
	Map<String, Object> input = new HashMap<>();
	Map<String, Object> payload = new HashMap<>();
   	payload.put("event", "conductor:TEST_EVENT");
   	payload.put("someId", generatedId);
	input.put("payload", payload);
	input.put("name", "conductor");
	input.put("version", 2);
	Map<String, Object> inputParams = new HashMap<>();
	inputParams.put("k1", "${payload.someId}");
	inputParams.put("k2", "${name}");
	CompletableFuture.runAsync(() -> {
		for (int i = 0; i < 10000; i++) {
			generatedId.set("test-" + i);
			payload.put("someId", generatedId.get());
			Object jsonObj = null;
			try {
				jsonObj = objectMapper.readValue(objectMapper.writeValueAsString(input), Object.class);
			} catch (JsonProcessingException e) {
				e.printStackTrace();
				return;
			}
			Map<String, Object> replaced = parametersUtils.replace(inputParams, jsonObj);
			assertNotNull(replaced);
			assertEquals(generatedId.get(), replaced.get("k1"));
			assertEquals("conductor", replaced.get("k2"));
			assertNull(replaced.get("k3"));
		}
	}, executorService).get();
	executorService.shutdown();
}