IndicCompositeCharacterComparator implements Comparator<String> { public int compare(String o1, String o2) { if (o1.length() < o2.length()) { return 1; } if (o1.length() > o2.length()) { return -1; } return o1.compareTo(o2); }  int compare(String o1, String o2);  }
@Test public void testLengthIsEqualAndStringsAreEqual() { String oneString = "\u0938\u0924"; String twoString = "\u0938\u0924"; int result = new IndicCompositeCharacterComparator().compare(oneString, twoString); assertTrue("expected to be equal", result == 0); }
@Test public void testLengthIsEqualAndStringsAreNotEqual() { String oneString = "\u0938\u0924"; String twoString = "\u0924\u0938"; int result = new IndicCompositeCharacterComparator().compare(oneString, twoString); assertTrue("expected not to be equal", result != 0); }
@Test public void testFirstStringIsShorter() { String oneString = "\u0938\u0924"; String twoString = "\u0938\u0924\u0938\u0924"; int result = new IndicCompositeCharacterComparator().compare(oneString, twoString); assertTrue("expected to be greater than", result >= 1); }
@Test public void testFirstStringIsLonger() { String oneString = "\u0938\u0924\u0938\u0924"; String twoString = "\u0938\u0924"; int result = new IndicCompositeCharacterComparator().compare(oneString, twoString); assertTrue("expected to be less than", result <= -1); }