View Javadoc
1   package com.atlassian.plugin.util;
2   
3   import junit.framework.TestCase;
4   
5   import static com.atlassian.plugin.util.EfficientStringUtils.endsWith;
6   
7   public class EfficientStringUtilsTest extends TestCase {
8       public void testEndsWith() {
9           assertTrue(endsWith("abc", "c"));
10          assertTrue(endsWith("foo.xml", ".", "xml"));
11          assertTrue(endsWith("foo", "foo"));
12      }
13  
14      public void testEndsWithNoMatchingSuffix() {
15          assertFalse(endsWith("foo", "ooo"));
16          assertFalse(endsWith("foo.xml", "."));
17      }
18  
19      public void testEndsWithEmptySuffixes() {
20          // Degenerate cases: any string ends with nothing
21          assertTrue(endsWith("foo", ""));
22          assertTrue(endsWith("", ""));
23          assertTrue(endsWith("foo"));
24          assertTrue(endsWith(""));
25      }
26  }