@Test
public void agentWithUserData() {

    TestBuildAgentConfiguration config = new TestBuildAgentConfiguration();
    Map<String, String> customParams = new HashMap<>();
    customParams.put("KEY1", "VALUE1");
    customParams.put("KEY2", "VALUE2");
    CloudInstanceUserData userData = new CloudInstanceUserData("", "", "", null, "", "", customParams);
    config.getBuildParameters()
            .withEnv("TC_DK_CLD_CLIENT_UUID", UUID.randomUUID().toString())
            .withEnv("TC_DK_CLD_AGENT_PARAMS", userData.serialize());
    AgentController ctrl = new AgentController(config);
    ctrl.init();
    assertThat(config.getConfigurationParameters()).containsAllEntriesOf(customParams);
}