Exemple #1
0
  /** @throws Exception */
  public static void testCutString() throws Exception {
    String src, res, actual;

    src = Locale.getString("A_SOURCE"); // $NON-NLS-1$
    res = Locale.getString("A_RESULT"); // $NON-NLS-1$
    actual = TextUtil.cutString(src, 80);
    assertNotNull(actual);
    assertEquals("A:", res, actual); // $NON-NLS-1$

    src = Locale.getString("B_SOURCE"); // $NON-NLS-1$
    res = Locale.getString("B_RESULT"); // $NON-NLS-1$
    actual = TextUtil.cutString(src, 80);
    assertNotNull(actual);
    assertEquals("B:", res, actual); // $NON-NLS-1$

    src = Locale.getString("C_SOURCE"); // $NON-NLS-1$
    res = Locale.getString("C_RESULT"); // $NON-NLS-1$
    actual = TextUtil.cutString(src, 80);
    assertNotNull(actual);
    assertEquals("C:", res, actual); // $NON-NLS-1$

    src = Locale.getString("D_SOURCE"); // $NON-NLS-1$
    res = Locale.getString("D_RESULT"); // $NON-NLS-1$
    actual = TextUtil.cutString(src, 80);
    assertNotNull(actual);
    assertEquals("D:", res, actual); // $NON-NLS-1$
  }