PropertyValidationContext { protected Collection<String> validateProperties(final Map<String, String> properties, final VersionedProcessGroup flow, final String flowId, final ControllerServiceLookup controllerServiceLookup) { final List<String> validationErrors = new ArrayList<>(); computePropertyValidationErrors(properties, validationErrors); validateNoExtraProperties(properties, validationErrors); validateControllerServiceReferences(properties, flow, flowId, controllerServiceLookup, validationErrors); return validationErrors; } PropertyValidationContext(final Map<String, PropertyDescriptor> propertyDescriptors, final boolean dynamicPropertiesSupported);   }
@Test public void testExtraProperties() { final Map<String, PropertyDescriptor> descriptors = new HashMap<>(); final VersionedProcessGroup flow = new VersionedProcessGroup(); final Map<String, String> properties = new HashMap<>(); properties.put("Extra Property", "Extra Value"); final ControllerServiceLookup serviceLookup = Mockito.mock(ControllerServiceLookup.class); final PropertyValidationContext dynamicNotAllowed = new PropertyValidationContext(descriptors, false); Collection<String> validationErrors = dynamicNotAllowed.validateProperties(properties, flow, "flow-a", serviceLookup); assertEquals(1, validationErrors.size()); final PropertyValidationContext dynamicAllowed = new PropertyValidationContext(descriptors, true); validationErrors = dynamicAllowed.validateProperties(properties, flow,"flow-a", serviceLookup); assertTrue(validationErrors.isEmpty()); }