### Question:
StringFormatUtil { public static String formatFilesize(String filesize, int decimalPlaces) { try { return formatFilesize(Long.parseLong(filesize), decimalPlaces); } catch (NumberFormatException e) { LOG.error("Failed to format filesize {}, not a valid number.", filesize); } return filesize; } private  StringFormatUtil(); static String formatFilesize(String filesize, int decimalPlaces); static String formatFilesize(long filesize, int decimalPlaces); static String truncateText(String text, int length); static String urlEncode(String value); static String removeQueryParameter(String query, String key); static String makeToken(String input, String replacement);  }### Answer:
@Test public void testFormatFilesizeBytes() { assertEquals("6 B", StringFormatUtil.formatFilesize("6", 0)); }
@Test public void testFormatFilesizeGB() { long size = 562l * 1024l * 1024l * 1024l; assertEquals("562 GB", StringFormatUtil.formatFilesize(size, 1)); }
@Test public void testFormatFilesizeGBWithDecimal() { long size = (562l * 1024l * 1024l * 1024l) / 100; assertEquals("5.6 GB", StringFormatUtil.formatFilesize(size, 1)); }