From 5cb73e7dd93051d740b16f6597353c276b8c4e2f Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 16 Nov 2018 17:15:15 +0000 Subject: [PATCH] fixed set the expected value size --- .../chronicle/map/CHMUseCasesTest.java | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java index acb56f782..1b1cf7fc8 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java +++ b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java @@ -46,7 +46,6 @@ import java.io.IOException; import java.io.Serializable; import java.nio.ByteBuffer; import java.util.*; -import java.util.concurrent.ExecutionException; import java.util.function.BiFunction; import static java.lang.Math.max; @@ -338,8 +337,7 @@ public class CHMUseCasesTest { } @Test - public void testArrayOfString() throws ExecutionException, InterruptedException, - IOException { + public void testArrayOfString() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(CharSequence.class, I1.class) @@ -381,7 +379,7 @@ public class CHMUseCasesTest { } @Test - public void testCharArrayValue() throws ExecutionException, InterruptedException, IOException { + public void testCharArrayValue() throws IOException { int valueSize = 10; @@ -390,6 +388,7 @@ public class CHMUseCasesTest { ChronicleMapBuilder builder = ChronicleMapBuilder .of(CharSequence.class, char[].class) + .averageValue(expected) .entries(1); try (ChronicleMap map = newInstance(builder)) { @@ -402,7 +401,7 @@ public class CHMUseCasesTest { @Test public void testByteArrayArrayValue() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(byte[].class, byte[][].class) @@ -422,7 +421,7 @@ public class CHMUseCasesTest { } @Test - public void bondExample() throws IOException, InterruptedException { + public void bondExample() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder.of(String.class, BondVOInterface.class) .entries(1) @@ -449,7 +448,7 @@ public class CHMUseCasesTest { } @Test - public void testLargeCharSequenceValueWriteOnly() throws ExecutionException, InterruptedException, IOException { + public void testLargeCharSequenceValueWriteOnly() throws IOException { int valueSize = 1000000; @@ -468,7 +467,7 @@ public class CHMUseCasesTest { @Test public void testEntrySpanningSeveralChunks() - throws ExecutionException, InterruptedException, IOException { + throws IOException { int salefactor = 100; int valueSize = 10 * salefactor; @@ -489,7 +488,7 @@ public class CHMUseCasesTest { } @Test - public void testKeyValueSizeBySample() throws ExecutionException, InterruptedException, + public void testKeyValueSizeBySample() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder @@ -506,7 +505,7 @@ public class CHMUseCasesTest { @Test public void testLargeCharSequenceValue() - throws ExecutionException, InterruptedException, IOException { + throws IOException { int valueSize = 5_000_000; @@ -524,7 +523,7 @@ public class CHMUseCasesTest { } @Test - public void testStringStringMap() throws ExecutionException, InterruptedException, + public void testStringStringMap() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder @@ -542,7 +541,7 @@ public class CHMUseCasesTest { } @Test - public void testStringStringMapMutableValue() throws ExecutionException, InterruptedException, IOException { + public void testStringStringMapMutableValue() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(String.class, String.class) @@ -556,7 +555,7 @@ public class CHMUseCasesTest { } @Test - public void testCharSequenceMixingKeyTypes() throws ExecutionException, InterruptedException, IOException { + public void testCharSequenceMixingKeyTypes() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) @@ -573,7 +572,7 @@ public class CHMUseCasesTest { } @Test - public void testCharSequenceMixingValueTypes() throws ExecutionException, InterruptedException, IOException { + public void testCharSequenceMixingValueTypes() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) @@ -595,7 +594,7 @@ public class CHMUseCasesTest { */ @Test public void testCharSequenceCharSequenceMap() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(CharSequence.class, CharSequence.class) @@ -891,7 +890,7 @@ public class CHMUseCasesTest { @Test public void testIntegerIntegerMap() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(Integer.class, Integer.class) @@ -950,7 +949,7 @@ public class CHMUseCasesTest { } @Test - public void testLongLongMap() throws ExecutionException, InterruptedException, IOException { + public void testLongLongMap() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(Long.class, Long.class) @@ -990,7 +989,7 @@ public class CHMUseCasesTest { } @Test - public void testDoubleDoubleMap() throws ExecutionException, InterruptedException, IOException { + public void testDoubleDoubleMap() throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(Double.class, Double.class) @@ -1026,7 +1025,7 @@ public class CHMUseCasesTest { @Test public void testByteArrayByteArrayMap() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(byte[].class, byte[].class).averageKeySize(4).averageValueSize(4) @@ -1072,8 +1071,8 @@ public class CHMUseCasesTest { } @Test - public void testByteBufferByteBufferDefaultKeyValueMarshaller() throws ExecutionException, - InterruptedException, IOException { + public void testByteBufferByteBufferDefaultKeyValueMarshaller() throws + IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(ByteBuffer.class, ByteBuffer.class) @@ -1100,7 +1099,7 @@ public class CHMUseCasesTest { @Test public void testByteBufferByteBufferMap() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(ByteBuffer.class, ByteBuffer.class) @@ -1209,7 +1208,7 @@ public class CHMUseCasesTest { @Test public void testByteBufferDirectByteBufferMap() - throws ExecutionException, InterruptedException, IOException { + throws IOException { ChronicleMapBuilder builder = ChronicleMapBuilder .of(ByteBuffer.class, ByteBuffer.class) @@ -2316,7 +2315,7 @@ public class CHMUseCasesTest { new StringBytesReader(), CharSequenceBytesWriter.INSTANCE)); try (ChronicleMap> map = newInstance(builder)) { - map.put("1", Collections.emptyList()); + map.put("1", Collections.emptyList()); map.put("2", asList("two-A")); List list1 = new ArrayList<>(); @@ -2362,7 +2361,7 @@ public class CHMUseCasesTest { new StringBytesReader(), CharSequenceBytesWriter.INSTANCE)); try (ChronicleMap> map = newInstance(builder)) { - map.put("1", Collections.emptySet()); + map.put("1", Collections.emptySet()); map.put("2", new LinkedHashSet<>(asList("one"))); Set list1 = new LinkedHashSet<>(); @@ -2409,7 +2408,7 @@ public class CHMUseCasesTest { .valueMarshaller(valueMarshaller); try (ChronicleMap> map = newInstance(builder)) { - map.put("1", Collections.emptyMap()); + map.put("1", Collections.emptyMap()); map.put("2", mapOf("one", "uni")); Map map1 = new LinkedHashMap<>(); @@ -2451,7 +2450,7 @@ public class CHMUseCasesTest { .valueMarshaller(valueMarshaller); try (ChronicleMap> map = newInstance(builder)) { - map.put("1", Collections.emptyMap()); + map.put("1", Collections.emptyMap()); map.put("2", mapOf("one", 1)); Map map1 = new LinkedHashMap<>(); @@ -2489,7 +2488,7 @@ public class CHMUseCasesTest { .averageValue(mapOf("two", 2)) .entries(2); try (ChronicleMap> map = newInstance(builder)) { - map.put("1", Collections.emptyMap()); + map.put("1", Collections.emptyMap()); map.put("2", mapOf("two", 2)); assertEquals(mapOf("two", 2), map.get("2"));