### Question:
ServiceMonitoringDefinitionsDescriptorValidatorImpl extends DescriptorValidatorImpl<ServiceMonitoringDefinitionsDescriptor> implements DescriptorValidator<ServiceMonitoringDefinitionsDescriptor> { @Override public Set<ConstraintViolation<ServiceMonitoringDefinitionsDescriptor>> getViolations(ServiceMonitoringDefinitionsDescriptor descriptor) { Set<ConstraintViolation<ServiceMonitoringDefinitionsDescriptor>> violations = validator.validate(descriptor); if (!violations.isEmpty()) { return violations; } violations = refValidator.validate(descriptor); if (!violations.isEmpty()) { return violations; } return validateDescriptor(descriptor); } ServiceMonitoringDefinitionsDescriptorValidatorImpl(
      Validator validator,
      ReferenceValidator refValidator,
      Set<String> builtInRoleTypes,
      Set<String> builtInNamesForCrossEntityAggregateMetrics,
      Set<String> builtInEntityTypes,
      Set<String> builtInAttributes); @Override Set<ConstraintViolation<ServiceMonitoringDefinitionsDescriptor>> getViolations(ServiceMonitoringDefinitionsDescriptor descriptor); Set<ConstraintViolation<ServiceMonitoringDefinitionsDescriptor>> validateDescriptor(ServiceMonitoringDefinitionsDescriptor descriptor);  }### Answer:
@Test public void testMetricsWithBadPrefixesMDL() throws Exception { Set<ConstraintViolation<ServiceMonitoringDefinitionsDescriptor>> validations = validator.getViolations(SdlTestUtils.getValidatorMdl( "monitoring/service_with_bad_prefixes.mdl")); assertEquals(2, validations.size()); ConstraintViolation<ServiceMonitoringDefinitionsDescriptor> serviceViolation = null; ConstraintViolation<ServiceMonitoringDefinitionsDescriptor> roleViolation = null; for (ConstraintViolation<ServiceMonitoringDefinitionsDescriptor> validation : validations) { if (validation.getMessage().contains("service_metric_1")) { serviceViolation = validation; } if (validation.getMessage().contains("role_metric_2")) { roleViolation = validation; } } assertNotNull(serviceViolation); assertNotNull(roleViolation); assertEquals("ECHO.service_metric_1.name", serviceViolation.getPropertyPath().toString()); assertEquals("ECHO.ECHOROLE.role_metric_2.name", roleViolation.getPropertyPath().toString()); }