Skip to content

Commit b2cedd0

Browse files
committed
Refactor test methods and constants to private visibility for encapsulation
1 parent f85bbf5 commit b2cedd0

File tree

10 files changed

+40
-40
lines changed

10 files changed

+40
-40
lines changed

src/test/java/net/openhft/hashing/City64_1_1_Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void testCityWithOneSeed() {
5151
test(LongHashFunction.city_1_1(0L, 0L), HASHES_OF_LOOPING_BYTES_WITH_SEEDS_0_0);
5252
}
5353

54-
public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
54+
private void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
5555
byte[] data = new byte[len];
5656
for (int j = 0; j < data.length; j++) {
5757
data[j] = (byte) j;
@@ -81,7 +81,7 @@ public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
8181
// }
8282
// }
8383

84-
public static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEEDS = {
84+
private static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEEDS = {
8585
-7286425919675154353L,
8686
-4728684028706075820L,
8787
-4422457430495752843L,
@@ -1109,7 +1109,7 @@ public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
11091109
-7169091905545403953L,
11101110
};
11111111

1112-
public static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEEDS_0_0 = new long[]{
1112+
private static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEEDS_0_0 = new long[]{
11131113
6665653827947065942L,
11141114
-5789604048565922719L,
11151115
-3544073118936500090L,

src/test/java/net/openhft/hashing/LongHashFunctionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import static org.junit.Assert.assertNotEquals;
2929
import static org.junit.Assert.fail;
3030

31-
public class LongHashFunctionTest {
31+
class LongHashFunctionTest {
3232

3333
private static ByteOrder nonNativeOrder() {
3434
return nativeOrder() == LITTLE_ENDIAN ? BIG_ENDIAN : LITTLE_ENDIAN;
@@ -53,7 +53,7 @@ private static void testVoid(LongHashFunction f, long eh, int len) {
5353
assertEquals("void", eh, f.hashVoid());
5454
}
5555

56-
public static void testBoolean(LongHashFunction f, int len) {
56+
private static void testBoolean(LongHashFunction f, int len) {
5757
if (len != 1)
5858
return;
5959
for (boolean b : new boolean[] {true, false}) {

src/test/java/net/openhft/hashing/LongTupleHashFunctionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import static org.junit.Assert.assertTrue;
1818
import static org.junit.Assert.fail;
1919

20-
public class LongTupleHashFunctionTest {
20+
class LongTupleHashFunctionTest {
2121

2222
private static ByteOrder nonNativeOrder() {
2323
return nativeOrder() == LITTLE_ENDIAN ? BIG_ENDIAN : LITTLE_ENDIAN;
@@ -89,7 +89,7 @@ private static void testVoid(LongTupleHashFunction f, long[] eh, int len) {
8989
}
9090
}
9191

92-
public static void testBoolean(LongTupleHashFunction f, int len) {
92+
private static void testBoolean(LongTupleHashFunction f, int len) {
9393
if (len != 1)
9494
return;
9595
for (boolean b : new boolean[] {true, false}) {

src/test/java/net/openhft/hashing/MetroHashTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void testMetroWithSeeds() {
3232
test(LongHashFunction.metro(42L), HASHES_OF_LOOPING_BYTES_WITH_SEED_42);
3333
}
3434

35-
public void test(LongHashFunction metro, long[] hashesOfLoopingBytes) {
35+
private void test(LongHashFunction metro, long[] hashesOfLoopingBytes) {
3636
byte[] data = new byte[len];
3737
for (int j = 0; j < data.length; j++) {
3838
data[j] = (byte) j;
@@ -67,7 +67,7 @@ public void test(LongHashFunction metro, long[] hashesOfLoopingBytes) {
6767
* }
6868
*/
6969

70-
public static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
70+
private static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
7171
8097384203561113213L,
7272
1044577374344929784L,
7373
-5864552078195947561L,
@@ -1095,7 +1095,7 @@ public void test(LongHashFunction metro, long[] hashesOfLoopingBytes) {
10951095
9003958434955366904L
10961096
};
10971097

1098-
public static long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
1098+
private static long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
10991099
6500896835765953563L,
11001100
-5864898193651956393L,
11011101
-8878504184760441104L,

src/test/java/net/openhft/hashing/OriginalFarmHashTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
* Based on https://github.com/google/farmhash/blob/34c13ddfab0e35422f4c3979f360635a8c050260/src/farmhash.cc
2929
*/
3030
public class OriginalFarmHashTest {
31-
static final int kDataSize = 1 << 20;
32-
static final int kTestSize = 300;
33-
static final byte[] data = new byte[kDataSize];
31+
private static final int kDataSize = 1 << 20;
32+
private static final int kTestSize = 300;
33+
private static final byte[] data = new byte[kDataSize];
3434
static {
3535
long a = 9;
3636
long b = 777;
@@ -44,9 +44,9 @@ public class OriginalFarmHashTest {
4444
}
4545
}
4646

47-
static final int c1 = 0xcc9e2d51;
47+
private static final int c1 = 0xcc9e2d51;
4848

49-
static long createSeed(int offset, int salt) {
49+
private static long createSeed(int offset, int salt) {
5050
int h = salt;
5151
h = h * c1;
5252
h ^= (h >>> 17);
@@ -64,15 +64,15 @@ static long createSeed(int offset, int salt) {
6464
return h & 0xFFFFFFFFL;
6565
}
6666

67-
static long SEED(int offset) {
67+
private static long SEED(int offset) {
6868
return createSeed(offset, -1);
6969
}
7070

71-
static long SEED0(int offset) {
71+
private static long SEED0(int offset) {
7272
return createSeed(offset, 0);
7373
}
7474

75-
static long SEED1(int offset) {
75+
private static long SEED1(int offset) {
7676
return createSeed(offset, 1);
7777
}
7878

@@ -88,7 +88,7 @@ public void testNa() {
8888
testNa(0, kDataSize, expectedIndex);
8989
}
9090

91-
static int testNa(int offset, int len, int expectedIndex) {
91+
private static int testNa(int offset, int len, int expectedIndex) {
9292
LongHashFunction f = LongHashFunction.farmNa(SEED0(offset), SEED1(offset));
9393
long h = f.hashBytes(data, offset, len);
9494
assertEquals(NA_EXPECTED[expectedIndex++], h >>> 32);
@@ -119,7 +119,7 @@ public void testUo() {
119119
testUo(0, kDataSize, expectedIndex);
120120
}
121121

122-
static int testUo(int offset, int len, int expectedIndex) {
122+
private static int testUo(int offset, int len, int expectedIndex) {
123123
LongHashFunction f = LongHashFunction.farmUo(SEED(offset));
124124
long h = f.hashBytes(data, offset, len);
125125
assertEquals(UO_EXPECTED[expectedIndex++], h >>> 32);
@@ -146,7 +146,7 @@ public void testUoGo() {
146146
}
147147
}
148148

149-
static final Object[][] GOLDEN_64 = {
149+
private static final Object[][] GOLDEN_64 = {
150150
{0xb3454265b6df75e3L, "a"},
151151
{0xaa8d6e5242ada51eL, "ab"},
152152
{0x24a5b3a074e7f369L, "abc"},
@@ -179,7 +179,7 @@ public void testUoGo() {
179179
{0x5a0a6efd52e84e2aL, "How can you write a big system without C++? -Paul Glick"},
180180
};
181181

182-
static final long[] NA_EXPECTED = {
182+
private static final long[] NA_EXPECTED = {
183183
1140953930L, 861465670L,
184184
3277735313L, 2681724312L,
185185
2598464059L, 797982799L,
@@ -1268,7 +1268,7 @@ public void testUoGo() {
12681268
4166253320L, 2747410691L,
12691269
};
12701270

1271-
static final long[] UO_EXPECTED = {
1271+
private static final long[] UO_EXPECTED = {
12721272
3277735313L, 2681724312L,
12731273
2598464059L, 797982799L,
12741274
2603993599L, 921001710L,

src/test/java/net/openhft/hashing/PrimitivesTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
public class PrimitivesTest {
1212

13-
static final long l = 0x0123456789ABCDEFL;
14-
static final int i = 0x01234567;
15-
static final short s = 0x0123;
16-
static final short c = 0x4567;
17-
18-
static final long rl = 0xEFCDAB8967452301L;
19-
static final int ri = 0x67452301;
20-
static final short rs = 0x2301;
21-
static final short rc = 0x6745;
13+
private static final long l = 0x0123456789ABCDEFL;
14+
private static final int i = 0x01234567;
15+
private static final short s = 0x0123;
16+
private static final short c = 0x4567;
17+
18+
private static final long rl = 0xEFCDAB8967452301L;
19+
private static final int ri = 0x67452301;
20+
private static final short rs = 0x2301;
21+
private static final short rc = 0x6745;
2222

2323
@Test
2424
public void testLE() {

src/test/java/net/openhft/hashing/WyHashTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void testWyHasWithOneSeed() {
3131
test(LongHashFunction.wy_3(42L), HASHES_OF_LOOPING_BYTES_WITH_SEED_42);
3232
}
3333

34-
public void test(LongHashFunction wyHash, long[] hashesOfLoopingBytes) {
34+
private void test(LongHashFunction wyHash, long[] hashesOfLoopingBytes) {
3535
byte[] data = new byte[len];
3636
for (int j = 0; j < data.length; j++) {
3737
data[j] = (byte) j;
@@ -66,7 +66,7 @@ public void test(LongHashFunction wyHash, long[] hashesOfLoopingBytes) {
6666
* }
6767
* <\pre>
6868
*/
69-
public static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
69+
private static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
7070
0L,
7171
-1498634010482895780L,
7272
6867524088326895660L,
@@ -1094,7 +1094,7 @@ public void test(LongHashFunction wyHash, long[] hashesOfLoopingBytes) {
10941094
-1455749094773635190L
10951095
};
10961096

1097-
public static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
1097+
private static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
10981098
0L,
10991099
-5489459004343878315L,
11001100
7503380622199085724L,

src/test/java/net/openhft/hashing/XXH128Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testXXH128WithOneSeed() {
5252
test(LongTupleHashFunction.xx128(42L), LongHashFunction.xx128low(42L), XXH128Test_HASHES.HASHES_OF_LOOPING_BYTES_WITH_SEED_42);
5353
}
5454

55-
public void test(LongTupleHashFunction h, LongHashFunction hl, long[][] hashesOfLoopingBytes) {
55+
private void test(LongTupleHashFunction h, LongHashFunction hl, long[][] hashesOfLoopingBytes) {
5656
byte[] data = new byte[len];
5757
for (int j = 0; j < data.length; j++) {
5858
data[j] = (byte) j;

src/test/java/net/openhft/hashing/XXH3Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testXXH3WithOneSeed() {
5252
test(LongHashFunction.xx3(42L), XXH3Test_HASHES.HASHES_OF_LOOPING_BYTES_WITH_SEED_42);
5353
}
5454

55-
public void test(LongHashFunction h, long[] hashesOfLoopingBytes) {
55+
private void test(LongHashFunction h, long[] hashesOfLoopingBytes) {
5656
byte[] data = new byte[len];
5757
for (int j = 0; j < data.length; j++) {
5858
data[j] = (byte) j;

src/test/java/net/openhft/hashing/XxHashTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void testCityWithOneSeed() {
4848
test(LongHashFunction.xx(42L), HASHES_OF_LOOPING_BYTES_WITH_SEED_42);
4949
}
5050

51-
public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
51+
private void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
5252
byte[] data = new byte[len];
5353
for (int j = 0; j < data.length; j++) {
5454
data[j] = (byte) j;
@@ -83,7 +83,7 @@ public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
8383
* }
8484
*/
8585

86-
public static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
86+
private static final long[] HASHES_OF_LOOPING_BYTES_WITHOUT_SEED = {
8787
-1205034819632174695L,
8888
-1642502924627794072L,
8989
5216751715308240086L,
@@ -1111,7 +1111,7 @@ public void test(LongHashFunction city, long[] hashesOfLoopingBytes) {
11111111
8014460039616323415L
11121112
};
11131113

1114-
public static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
1114+
private static final long[] HASHES_OF_LOOPING_BYTES_WITH_SEED_42 = {
11151115
-7444071767201028348L,
11161116
-8959994473701255385L,
11171117
7116559933691734543L,

0 commit comments

Comments
 (0)