TextUtils { public static String getLastSevenNumbers(String uniqueId) { if (uniqueId == null) { return null; } int length = uniqueId.length(); return length > 7 ? uniqueId.substring(length - 7) : uniqueId; }  static boolean isEmpty(String url); static String getLastSevenNumbers(String uniqueId); @NonNull static String lintUrl(String url); static String truncateByDoubleColons(String source, int level);  }
@Test public void should_return_null_when_unique_id_is_null() throws Exception { assertThat("Should return null", TextUtils.getLastSevenNumbers(null), is(nullValue())); }
@Test public void should_return_unique_id_when_unique_id_length_less_7() throws Exception { String uniqueId = "123456"; assertThat("Should return uniqueId", TextUtils.getLastSevenNumbers(uniqueId), is(uniqueId)); }
@Test public void should_return_last_seven_numbers_when_unique_id_more_7() throws Exception { String uniqueId = "1234567890"; assertThat("Should return last 7 numbers", TextUtils.getLastSevenNumbers(uniqueId), is("4567890")); }