FileSize implements Comparable<FileSize> { @Override public int compareTo(FileSize o) { int result; if (o == null || bytes > o.bytes) { result = 1; } else if (bytes < o.bytes) { result = -1; } else { result = 0; } return result; } FileSize(String string);  FileSize(long bytes); long getBytes(); void setBytes(long bytes); @Override String toString(); long getMultiplier(char multiplierChar); static String convertToStringRepresentation(final long value); @Override int compareTo(FileSize o); @Override boolean equals(Object o); @Override int hashCode();  }
@Test (dataProvider = "testCompareTo") public void testCompareTo(long size1, long size2, int result) throws Exception { Assert.assertEquals(new FileSize(size1).compareTo(new FileSize(size2)), result); }