|
14 | 14 |
|
15 | 15 | package org.apache.cloudstack.utils.bytescale;
|
16 | 16 |
|
17 |
| -import junit.framework.TestCase; |
| 17 | +import org.junit.Assert; |
18 | 18 | import org.junit.Test;
|
19 | 19 | import org.junit.runner.RunWith;
|
20 | 20 | import org.mockito.junit.MockitoJUnitRunner;
|
21 | 21 |
|
22 | 22 | @RunWith(MockitoJUnitRunner.class)
|
23 |
| -public class ByteScaleUtilsTest extends TestCase { |
| 23 | +public class ByteScaleUtilsTest { |
24 | 24 |
|
25 | 25 | @Test
|
26 |
| - public void validateMibToBytes() { |
| 26 | + public void validateMebibytesToBytes() { |
27 | 27 | long mib = 3000L;
|
28 |
| - long b = 1024L * 1024L * mib; |
29 |
| - assertEquals(b, ByteScaleUtils.mibToBytes(mib)); |
| 28 | + long bytes = 1024L * 1024L * mib; |
| 29 | + Assert.assertEquals(bytes, ByteScaleUtils.mebibytesToBytes(mib)); |
30 | 30 | }
|
31 | 31 |
|
32 | 32 | @Test
|
33 |
| - public void validateBytesToKib() { |
| 33 | + public void validateBytesToKibibytes() { |
34 | 34 | long kib = 3000L;
|
35 |
| - long b = 1024 * kib; |
36 |
| - assertEquals(kib, ByteScaleUtils.bytesToKib(b)); |
| 35 | + long bytes = 1024 * kib; |
| 36 | + Assert.assertEquals(kib, ByteScaleUtils.bytesToKibibytes(bytes)); |
37 | 37 | }
|
38 | 38 |
|
39 | 39 | @Test
|
40 |
| - public void validateBytesToMib() { |
| 40 | + public void validateBytesToMebibytes() { |
41 | 41 | long mib = 3000L;
|
42 |
| - long b = 1024L * 1024L * mib; |
43 |
| - assertEquals(mib, ByteScaleUtils.bytesToMib(b)); |
| 42 | + long bytes = 1024L * 1024L * mib; |
| 43 | + Assert.assertEquals(mib, ByteScaleUtils.bytesToMebibytes(bytes)); |
44 | 44 | }
|
45 | 45 |
|
46 | 46 | @Test
|
47 |
| - public void validateMibToBytesIfIntTimesIntThenMustExtrapolateIntMaxValue() { |
| 47 | + public void validateMebibytesToBytesIfIntTimesIntThenMustExtrapolateIntMaxValue() { |
48 | 48 | int mib = 3000;
|
49 |
| - long b = 1024L * 1024L * mib; |
50 |
| - assertEquals(b, ByteScaleUtils.mibToBytes(mib)); |
| 49 | + long bytes = 1024L * 1024L * mib; |
| 50 | + Assert.assertEquals(bytes, ByteScaleUtils.mebibytesToBytes(mib)); |
51 | 51 | }
|
52 | 52 |
|
53 | 53 | @Test
|
54 |
| - public void validateBytesToKibIfIntByIntThenMustExtrapolateIntMaxValue(){ |
55 |
| - int b = Integer.MAX_VALUE; |
56 |
| - assertEquals(b, ByteScaleUtils.bytesToKib(b * 1024L)); |
| 54 | + public void validateBytesToKibibytesIfIntByIntThenMustExtrapolateIntMaxValue(){ |
| 55 | + int bytes = Integer.MAX_VALUE; |
| 56 | + Assert.assertEquals(bytes, ByteScaleUtils.bytesToKibibytes(bytes * 1024L)); |
57 | 57 | }
|
58 | 58 | }
|
0 commit comments