Skip to content

Testing for a blank value #310

raboof opened this Issue Aug 21, 2013 · 4 comments

4 participants

raboof commented Aug 21, 2013

Both in decision, query and script tables, I think it would be useful to be able to easily test for blank values.

This has been sort of discussed before (#102, ), and indeed such a keyword does not currently exist, but I think it'd be useful to have (without resorting to a regular expression).


Maybe as a symbol type? Is that feasible?


I bumped into this problem today, too. I would like to solve it by registering a custom String Converter in the ConverterRegistry which might convert null to "<null>" and vice versa. Unfortunately there is another issue that I just discovered. #337


I provided a patch #338 for #337.
For Decision Tables and Script Tables, we now use something similar to

ConverterRegistry.addConverter(String.class, new NullStringConverter());


import fitnesse.slim.Converter;

public class NullStringConverter implements Converter<String> {

    private static final String NULL = "<null>";
    private static final String BLANK = "<blank>";

    public String fromString(String inputString) {
        if (inputString == null || inputString.isEmpty() || BLANK.equals(inputString)) {
            return "";
        if (NULL.equals(inputString)) {
            return null;
        return inputString.trim();

    public String toString(String obj) {
        if (obj == null) {
            return NULL;
        if ("".equals(obj)) {
            return BLANK;
        return obj.trim();

For query tables, we do the conversion "by hand".

@amolenaar amolenaar closed this Oct 3, 2013
mgibas commented Nov 20, 2013

Is it implemented already ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.