public CruiseConfig deserializeConfig(String content) throws Exception {
        String md5 = md5Hex(content);
        Element element = parseInputStream(new ByteArrayInputStream(content.getBytes()));
        LOGGER.debug("[Config Save] Updating config cache with new XML");

        CruiseConfig configForEdit = classParser(element, BasicCruiseConfig.class, configCache, new GoCipher(), registry, new ConfigReferenceElements()).parse();
        setMd5(configForEdit, md5);
        configForEdit.setOrigins(new FileConfigOrigin());
        return configForEdit;
    }
@Test
    void shouldThrowExceptionWhenCommandsContainLeadingSpaces() {
        String configXml =
                ("""
                        <cruise schemaVersion='%d'>
                          <pipelines group='first'>
                            <pipeline name='Test'>
                              <materials>
                                <hg url='../manual-testing/ant_hg/dummy' />
                              </materials>
                              <stage name='Functional'>
                                <jobs>
                                  <job name='Functional'>
                                    <tasks>
                                      <exec command='    bundle' args='arguments' />
                                    </tasks>
                                   </job>
                                </jobs>
                              </stage>
                            </pipeline>
                          </pipelines>
                        </cruise>""").formatted(CONFIG_SCHEMA_VERSION);

        assertThatThrownBy(() -> xmlLoader.deserializeConfig(configXml))
            .as("Should not allow command with trailing spaces")
            .hasMessageContaining("Command is invalid. \"    bundle\" should conform to the pattern - \\S(.*\\S)?");
    }