From 46e2e701d316e94f04e22ac577a26f5c4ca143b2 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Mon, 11 Feb 2019 12:28:53 +0000 Subject: [PATCH] https://github.com/OpenHFT/Chronicle-Map/issues/169 slightly improved the test - testValueAlignmentRelocation --- .../net/openhft/chronicle/map/ValueAlignmentRelocation.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/net/openhft/chronicle/map/ValueAlignmentRelocation.java b/src/test/java/net/openhft/chronicle/map/ValueAlignmentRelocation.java index 8ef339622..bcac360f1 100644 --- a/src/test/java/net/openhft/chronicle/map/ValueAlignmentRelocation.java +++ b/src/test/java/net/openhft/chronicle/map/ValueAlignmentRelocation.java @@ -23,6 +23,7 @@ public class ValueAlignmentRelocation { .entries(10) .create(); Random r = new Random(0); + for (int firstKeySize = 1; firstKeySize < 10; firstKeySize++) { byte[] firstKey = new byte[firstKeySize]; byte[] firstValue = new byte[8]; @@ -31,6 +32,9 @@ public class ValueAlignmentRelocation { for (int secondKeySize = 1; secondKeySize < 10; secondKeySize++) { byte[] secondKey = new byte[secondKeySize]; r.nextBytes(secondKey); + while (Arrays.equals(secondKey, firstKey)) { + r.nextBytes(secondKey); + } byte[] secondValue = new byte[1]; r.nextBytes(secondValue); map.clear(); @@ -41,6 +45,7 @@ public class ValueAlignmentRelocation { map.put(firstKey, thirdValue); for (int i = 0; i < 10; i++) { map.put(new byte[]{(byte) i}, new byte[]{(byte) i}); + map.put(("Hello" + i).getBytes(), "world".getBytes()); } Assert.assertTrue(Arrays.equals(map.get(firstKey), thirdValue)); }