H { public static String trunc(@NonNull final String s, final int l) { if (s.length() > l) { return s.substring(0, l); } else { return s; } }  static String intToHex(int i); static int toInt(byte b); static int toInt(byte[] bytes); static long toLong(byte[] bytes); static String bytesToHex(byte[] bytes); static byte[] reverse4bytes(byte[] b); static byte[] reverse8bytes(byte[] b); static byte[] toReversedBytes(short s); static byte[] toBytes(int i); static byte[] toReversedBytes(int i); static byte[] toBytes(long i); static String getDateFromMs(String ms); static String getDateFromSeconds(String seconds); static byte[] hexStringToByteArray(String s); static int crc8(byte[] b, int start, int len); static float round(float d, int decimalPlace); static double calculationByDistance(LatLng StartP, LatLng EndP); static byte[] concatArray(byte[] a, byte[] b); static String k(String s); static byte[] floatToByteArrayRev(float value); static byte[] floatToByteArray(float value); static float stringToFloat(String s); static String getLogFilename(); static String trunc(@NonNull final String s, final int l); static int dpToPx(int dp, @NonNull Context c); static Bitmap drawableToBitmap(int imgRes, int dpwidth, int dpheight, @NonNull Context c); static Bitmap drawableToBitmap(Drawable d, int dpwidth, int dpheight, @NonNull Context c); final static String NS; final static String RS; final static String S; }
@Test public void trunc_LoremIpsum_ReturnsSubstring() { final String RESULT = "Lorem ipsum dolor sit amet"; assertThat(H.trunc(LOREMIPSUM, 26), equalTo(RESULT)); }