ComponentUtils { public static String validateDataUnitValue(final String value) { final ParsedDataUnit parsedDataUnit = parseDataSize(value); return parsedDataUnit.getStringValue(); }  static VersionedProcessGroup getProcessGroupOrNotFound(final String processGroupId, final VersionedProcessGroup startingGroup); static VersionedProcessGroup getProcessGroupOrIllegalArgument(final String processGroupId, final VersionedProcessGroup startingGroup); static V getComponentOrNotFound(
            final String componentId,
            final VersionedProcessGroup startingGroup,
            final Function<VersionedProcessGroup, Set<V>> getComponentsFunction); static V getComponentOrIllegalArgument(
            final String componentId,
            final VersionedProcessGroup startingGroup,
            final Function<VersionedProcessGroup, Set<V>> getComponentsFunction); static Optional<V> locateComponent(
            final String componentId,
            final VersionedProcessGroup startingGroup,
            final Function<VersionedProcessGroup, Set<V>> getComponentsFunction); static Optional<VersionedProcessGroup> locateProcessGroup(final String processGroupId, final VersionedProcessGroup startingGroup); static Set<VersionedControllerService> getAncestorControllerServices(final String targetGroupId, final VersionedProcessGroup parentGroup); static Set<PropertyDescriptor> getControllerServicePropertyDescriptors(final ConfigurableComponentDefinition componentDefinition); static void populateControllerServicePropertyDescriptors(final FDFlow flow, final String componentGroupId,
                                                                    final ConfigurableComponentDefinition componentDefinition); static void populateControllerServicePropertyDescriptors(final ConfigurableComponentDefinition componentDefinition,
                                                                    final Set<VersionedControllerService> ancestorControllerServices); static void populateControllerServicePropertyDescriptors(final Set<PropertyDescriptor> controllerServiceProperties,
                                                                    final Set<VersionedControllerService> ancestorControllerServices); static void updatePropertyValues(final ConfigurableComponentDefinition componentDefinition,
                                            final Map<String,String> properties); static V removeComponent(
            final String componentId,
            final VersionedProcessGroup flowContent,
            final Function<VersionedProcessGroup, Set<V>> getComponentsFunction); static V removeComponent(
            final V componentConfig,
            final VersionedProcessGroup flowContent,
            final Function<VersionedProcessGroup, Set<V>> getComponentsFunction); static void removeComponentConnections(final String componentId, final VersionedProcessGroup processGroup); static void removeComponentConnections(final String componentId, final VersionedProcessGroup processGroup, final boolean recursive); static ConnectableComponent createConnectableComponent(final VersionedComponent component); static String getComponentName(final VersionedComponent requestComponent, final String requestType); static void configureComponent(final V requestComponent, final V resultComponent); static void configureConfigurableComponent(final V requestComponent, final V resultComponent); static boolean isNotNull(T object); static void validateTimePeriodValue(final String value); static String validateDataUnitValue(final String value); static void publishComponentAddedEvent(final FDFlowManager flowManager, final String flowId,
                                                  final String componentId, final VersionedProcessGroup flowContent); static void publishComponentModifiedEvent(final FDFlowManager flowManager, final String flowId,
                                                     final String componentId, final VersionedProcessGroup flowContent); static void publishComponentRemovedEvent(final FDFlowManager flowManager, final String flowId,
                                                    final String componentId, final VersionedProcessGroup flowContent); static void publishComponentEvent(final FDFlowManager flowManager, final String flowId,
                                             final String componentId, final FDFlowEventType eventType,
                                             final String eventDescription, final VersionedProcessGroup flowContent);  }
@Test public void testValidateDataSize() { final String input1 = "10 MB"; final String parsed1 = ComponentUtils.validateDataUnitValue(input1); Assert.assertEquals(input1, parsed1); final String input2 = "10 mb"; final String parsed2 = ComponentUtils.validateDataUnitValue(input2); Assert.assertEquals("10 MB", parsed2); final String input3 = "10 MB abc"; final String parsed3 = ComponentUtils.validateDataUnitValue(input3); Assert.assertEquals("10 MB", parsed3); final String input4 = "INVALID"; try { ComponentUtils.validateDataUnitValue(input4); Assert.fail("Should have thrown exception"); } catch (Exception e) { } final String input5 = "10.0 MB"; final String parsed5 = ComponentUtils.validateDataUnitValue(input5); Assert.assertEquals(input5, parsed5); }