### Question:
StringShorten { public static String right(String value, int maxLength) { return right(value, maxLength, "..."); }  static String left(String value, int maxLength); static String left(String value, int maxLength, String end); static String right(String value, int maxLength); static String right(String value, int maxLength, String beginning);  }### Answer:
@Test public void rightNull() { String value = null; String result = StringShorten.right(value, 10, "..."); assertThat(result, notNullValue()); assertThat(result.length(), equalTo(0)); assertThat(result, equalTo("")); }
@Test public void rightShort() { String value = "hello"; String result = StringShorten.right(value, 10, "..."); assertThat(result, notNullValue()); assertThat(result.length(), equalTo(5)); assertThat(result, equalTo(value)); }
@Test public void rightTooLong() { String value = "hello again in the wold of java and rest"; String result = StringShorten.right(value, 10, "..."); assertThat(result, notNullValue()); assertThat(result.length(), equalTo(10)); assertThat(result, equalTo("...nd rest")); }