Skip to content

Commit

Permalink
improve comments
Browse files Browse the repository at this point in the history
Change-Id: I67c7b38979b2c0603878d48929247ec0282d10d9
  • Loading branch information
javeme committed Mar 19, 2021
1 parent bf56cf4 commit 52fbe8c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void testBytesToGB() {
value = UnitUtil.bytesToGB(Bytes.GB * 7357924680L);
Assert.assertEquals(7357924680d, value, 0d);

// overflow
// Bytes overflow long value
value = UnitUtil.bytesToGB(Bytes.GB * 9357924680L);
Assert.assertEquals(-7.821944504E9, value, 0d);
}
Expand Down Expand Up @@ -337,7 +337,7 @@ public void testBytesToReadableString() {
(long) (755 * 1.024) * Bytes.PB);
Assert.assertEquals("7.75 EB", value);

// overflow
// Bytes overflow long value
value = UnitUtil.bytesToReadableString(Bytes.EB * 8);
Assert.assertEquals("0 B", value);
}
Expand Down Expand Up @@ -465,15 +465,15 @@ public void testBytesFromReadableString() {

@Test
public void testBytesFromReadableStringWithInvalidFormat() {
// no space
// No space
Assert.assertThrows(IllegalArgumentException.class, () -> {
UnitUtil.bytesFromReadableString("1kb");
}, e -> {
Assert.assertContains("Invalid readable bytes '1kb'",
e.getMessage());
});

// invalid unit
// Invalid unit
Assert.assertThrows(IllegalArgumentException.class, () -> {
UnitUtil.bytesFromReadableString("1 aBc");
}, e -> {
Expand All @@ -495,7 +495,7 @@ public void testBytesFromReadableStringWithInvalidFormat() {
Assert.assertContains("Unrecognized unit 2 MB", e.getMessage());
});

// invalid number
// Invalid number
Assert.assertThrows(IllegalArgumentException.class, () -> {
UnitUtil.bytesFromReadableString("2b kb");
}, e -> {
Expand All @@ -509,7 +509,7 @@ public void testBytesFromReadableStringWithInvalidFormat() {
e.getMessage());
});

// overflow
// Bytes overflow long value
Assert.assertThrows(IllegalArgumentException.class, () -> {
UnitUtil.bytesFromReadableString("8.1 EIB");
}, e -> {
Expand Down

0 comments on commit 52fbe8c

Please sign in to comment.