View Javadoc

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