package no.steria.skuldsku.testrunner.common;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import no.steria.skuldsku.testrunner.httprunner.result.HttpCallResult;


public final class HttpClientIdentifierMapper implements ClientIdentifierMapper {

    private final Map<String, String> map;
    
    public HttpClientIdentifierMapper(List<HttpCallResult> results) {
        map = new HashMap<>();
        for (HttpCallResult r : results) {
            map.put(r.getExpected().getClientIdentifier(), r.getActual().getClientIdentifier());
        }
        map.put(null, null);
        map.put("", "");
    }
    
    @Override
    public String translateToActual(String expectedClientIdentifier) {
        return map.get(expectedClientIdentifier);
    }
    
}

@@ -729,14 +729,28 @@
     
-return
+final String value =
  map
@@ -781,16 +781,83 @@
 ifier);%0A
+        return (value != null) ? value : expectedClientIdentifier;%0A
     %7D%0A  

Use expected identifier as actual if no match can be found.