@Test
public void tokenWithEncoding() throws Exception {

  final String jobNameWithSpaces = "my job";
  final String encodedJobName = URLEncoder.encode(jobNameWithSpaces, "UTF-8");
  Map<String, String> customContextInfo = new HashMap<>();
  customContextInfo = new HashMap<>();
  customContextInfo.put(CONTEXT_SERVER_TOKEN, SERVER_NAME);
  customContextInfo.put(CONTEXT_PROJECT_TOKEN, PROJECT_NAME);
  customContextInfo.put(CONTEXT_FLOW_TOKEN, FLOW_NAME);
  customContextInfo.put(CONTEXT_EXECUTION_ID_TOKEN, EXECUTION_ID);
  customContextInfo.put(CONTEXT_JOB_TOKEN, jobNameWithSpaces);
  customContextInfo.put(CONTEXT_JOB_STATUS_TOKEN, JOB_STATUS_NAME);
  final String urlWithOneToken =
      "http://www.linkedin.com?job=" + CONTEXT_JOB_TOKEN + "&flow=" + CONTEXT_FLOW_TOKEN;
  final String result =
      JobCallbackUtil.replaceTokens(urlWithOneToken, customContextInfo, true);
  Assert.assertEquals("http://www.linkedin.com?job=" + encodedJobName
      + "&flow=" + FLOW_NAME, result);
}