{
// test LIKE operator with the _ wildcard, which
// matches any single character
// first, some tests with the wildcard by itself
selector = new Selector("MyString LIKE '_'");
// test match against single character
message.setStringProperty("MyString", "a");
assertTrue(selector.accept(message));
// test match failure against multiple characters
message.setStringProperty("MyString", "aaaaa");
assertTrue(!selector.accept(message));
// test match failure against the empty string
message.setStringProperty("MyString", "");
assertTrue(!selector.accept(message));
// next, tests with wildcard at the beginning of the string
selector = new Selector("MyString LIKE '_bcdf'");
// test match at beginning of string
message.setStringProperty("MyString", "abcdf");
assertTrue(selector.accept(message));
// match failure in first character after wildcard
message.setStringProperty("MyString", "aXcdf");
assertTrue(!selector.accept(message));
// match failure in middle character
message.setStringProperty("MyString", "abXdf");
assertTrue(!selector.accept(message));
// match failure in last character
message.setStringProperty("MyString", "abcdX");
assertTrue(!selector.accept(message));
// match failure with empty string
message.setStringProperty("MyString", "");
assertTrue(!selector.accept(message));
// match failure due to extra characters at beginning
message.setStringProperty("MyString", "XXXabcdf");
assertTrue(!selector.accept(message));
// match failure due to extra characters at the end
message.setStringProperty("MyString", "abcdfXXX");
assertTrue(!selector.accept(message));
// test that the _ wildcard does not match the 'empty' character
message.setStringProperty("MyString", "bcdf");
assertTrue(!selector.accept(message));
// next, tests with wildcard at the end of the string
selector = new Selector("MyString LIKE 'abcd_'");
// test match at end of string
message.setStringProperty("MyString", "abcdf");
assertTrue(selector.accept(message));
// match failure in first character before wildcard
message.setStringProperty("MyString", "abcXf");
assertTrue(!selector.accept(message));
// match failure in middle character
message.setStringProperty("MyString", "abXdf");
assertTrue(!selector.accept(message));
// match failure in first character
message.setStringProperty("MyString", "Xbcdf");
assertTrue(!selector.accept(message));
// match failure with empty string
message.setStringProperty("MyString", "");
assertTrue(!selector.accept(message));
// match failure due to extra characters at beginning
message.setStringProperty("MyString", "XXXabcdf");
assertTrue(!selector.accept(message));
// match failure due to extra characters at the end
message.setStringProperty("MyString", "abcdfXXX");
assertTrue(!selector.accept(message));
// test that the _ wildcard does not match the 'empty' character
message.setStringProperty("MyString", "abcd");
assertTrue(!selector.accept(message));
// test match in middle of string
// next, tests with wildcard in the middle of the string
selector = new Selector("MyString LIKE 'ab_df'");
// test match in the middle of string
message.setStringProperty("MyString", "abcdf");
assertTrue(selector.accept(message));