// matches any sequence of characters
// note many of the tests are similar to those for _
// 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 against multiple characters
message.setStringProperty("MyString", "aaaaa");
assertTrue(selector.accept(message));
message.setStringProperty("MyString", "abcdf");
assertTrue(selector.accept(message));
// test match 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 with single character at beginning of string
message.setStringProperty("MyString", "Xbcdf");
assertTrue(selector.accept(message));
// match with multiple characters at beginning
message.setStringProperty("MyString", "XXbcdf");
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 the end
message.setStringProperty("MyString", "abcdfXXX");
assertTrue(!selector.accept(message));
// test that the % wildcard matches the empty string
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 of single character at end of string
message.setStringProperty("MyString", "abcdf");
assertTrue(selector.accept(message));
// test match of multiple characters at end of string
message.setStringProperty("MyString", "abcdfgh");
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));
// test that the % wildcard matches the empty string
message.setStringProperty("MyString", "abcd");
assertTrue(selector.accept(message));
// next, tests with wildcard in the middle of the string
selector = new Selector("MyString LIKE 'ab%df'");
// test match with single character in the middle of string
message.setStringProperty("MyString", "abXdf");
assertTrue(selector.accept(message));