SizeUtils { public static String humanReadableSize(Number size) { return humanReadableSize(size.longValue()); }  static String humanReadableSize(Number size); static final DecimalFormat DECIMAL_FORMAT; }
@Test public void humanSizeShouldAddByteUnitForSmallSize() { assertThat(humanReadableSize(1000)).isEqualTo("1000 B"); }
@Test public void humanSizeShouldScaleToKilobyteWhenSizeIsBetweenKilobyteAndMegabyte() { assertThat(humanReadableSize(1024)).isEqualTo("1 KiB"); }
@Test public void humanSizeShouldWorkWithZero() { assertThat(humanReadableSize(0)).isEqualTo("0 B"); }
@Test public void humanSizeShouldWorkWithNegative() { assertThat(humanReadableSize(-1)).isEqualTo("-1 B"); }
@Test public void humanSizeShouldScaleToMegabyteWhenSizeIsBetweenMegabyteAndGigabyte() { assertThat(humanReadableSize(1024 * 1024)).isEqualTo("1 MiB"); }
@Test public void humanSizeShouldScaleToGigabyteWhenSizeIsBiggerThanGigabyte() { assertThat(humanReadableSize(1024 * 1024 * 1024)).isEqualTo("1 GiB"); }
@Test public void humanSizeShouldCorrectlyCountKilobyte() { assertThat(humanReadableSize(42 * 1024)).isEqualTo("42 KiB"); }
@Test public void humanSizeShouldNotUseMoreThanOneDigitAfterComma() { assertThat(humanReadableSize(1.42 * 1024)).isEqualTo("1.4 KiB"); }
@Test public void humanSizeShouldNotUseMoreThanOneDigitAfterCommaAndRoundUpCorrectly() { assertThat(humanReadableSize(1.48 * 1024)).isEqualTo("1.5 KiB"); }