HashMap return method

You shouldn't have to copy the map. Just try using the returned reference:

Map<String, String> map = sensVal.getSensorValue("...");

Your method needs to return a Map<String,String>. In the code you have posted, the Map sensorValues is never initialized.

public Map<String, String> getSensorValue(String sensorName) {
    Map<String,String> sensorValues = new HashMap<String,String>();
    registerSensor(sensorName);
    sensorValues.put("x","25");
    sensorValues.put("y","26");
    sensorValues.put("z","27");
    return sensorValues;
}

Almost as Rich said in his answer, but your method returns a Map which cannot be cast to a HashMap. Try this

Map<String, String> map = sensVal.getSensorValue("...");

Or alternatively change your getSensorValue method so that it returns a HashMap