From 349b2e00933d7ce17f5aaa00d419f4ca47d9ab95 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Tue, 16 Dec 2014 16:33:16 +0000 Subject: [PATCH] "HCOLL-257 added test for - "Object serialization is failing when calling writeObject() / readObject()" --- .../chronicle/map/CHMUseCasesTest.java | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java index 7eac9d042..1f010bc2b 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java +++ b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java @@ -98,15 +98,26 @@ public class CHMUseCasesTest { } - /** - * String is not as efficient as CharSequence as a key or value but easier to use. The key can - * only be on heap and variable length serialised. - */ + @Ignore("HCOLL-257 Object serialization is failing when calling writeObject() / readObject()") + @Test + public void testPrefixStingFunctionSerialization() throws ExecutionException, + InterruptedException, IOException { + + ByteBufferBytes b = new ByteBufferBytes(ByteBuffer.allocate(512)); + + PrefixStingFunction expected = new PrefixStingFunction("New "); + b.writeObject(expected); + + b.clear(); + PrefixStingFunction actual = b.readObject(PrefixStingFunction.class); + assertEquals(expected, actual); + + } + + @Ignore("HCOLL-257 Object serialization is failing when calling writeObject() / readObject()") @Test public void testStringStringMap() throws ExecutionException, InterruptedException, IOException { - if (typeOfMap == TypeOfMap.STATELESS) - return; ChronicleMapBuilder builder = ChronicleMapBuilder .of(String.class, String.class); @@ -121,6 +132,22 @@ public class CHMUseCasesTest { } } + @Test + public void testStringSerialization() throws ExecutionException, + InterruptedException, IOException { + + ByteBufferBytes b = new ByteBufferBytes(ByteBuffer.allocate(512)); + + String expected = "Hello"; + b.writeObject(expected); + + b.clear(); + + String actual = (String) b.readObject(); + assertEquals(expected, actual); + + } + Collection closeables = new ArrayList();