Of multiple exclusion meta filters only one is evaluated
--------------------------------------------------------

                 Key: JBEHAVE-583
                 URL: https://jira.codehaus.org/browse/JBEHAVE-583
             Project: JBehave
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.4.5
            Reporter: Dennis Homann


Assuming meta info
{noformat}
Meta:
@environment all
@skip
{noformat}

the following filter may not exclude the scenario, although it should:

{noformat}
-environment preview -skip
{noformat}

Method {{match}} in {{MetaFilter}} returns immediately when one filter 
expression does not match. If "environment" is tested before "skip", {{match}} 
will return {{false}}, and scenario will not be excluded. The logic should be 
changed such that {{match}} will return {{true}}, iff any exclusion filter 
matches.

The actual order of evaluation depends on the order of property names returned 
by #getPropertyNames, which appears to be alphabetical.

{noformat}
    private boolean match(Properties properties, Meta meta) {
        for (Object key : properties.keySet()) {
            String property = (String) properties.get(key);
            for (String metaName : meta.getPropertyNames()) {
                if (key.equals(metaName)) {
                    String value = meta.getProperty(metaName);
                    if (StringUtils.isBlank(value)) {
                        return true;
                    } else if (property.contains("*")) {
                        return value.matches(property.replace("*", ".*"));
                    }
                    return properties.get(key).equals(value);
                }
            }
        }
        return false;
    }
{noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to