spec.append(':').append(subServiceName);
}
spec.append('=').append(userName);
// spec analysis
final Mapping mapping = new Mapping(spec.toString());
TestCase.assertEquals(getField(mapping, "serviceName"), serviceName);
TestCase.assertEquals(getField(mapping, "subServiceName"), subServiceName);
TestCase.assertEquals(getField(mapping, "userName"), userName);
// mapping
TestCase.assertEquals(userName, mapping.map(serviceName, subServiceName));
if (subServiceName == null) {
// Mapping without subServiceName must not match request with any
// subServiceName
TestCase.assertNull(mapping.map(serviceName, subServiceName + "-garbage"));
} else {
// Mapping with subServiceName must not match request without
// subServiceName
TestCase.assertNull(mapping.map(serviceName, null));
}
// no match for different service name
TestCase.assertNull(mapping.map(serviceName + "-garbage", subServiceName));
// no match for null service name
TestCase.assertNull(mapping.map(null, subServiceName));
}