From 9368e63f3ba39f19c1710a449a59170d052839b9 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Wed, 17 Dec 2014 10:01:15 +0000 Subject: [PATCH] moved testPrefixStingFunctionSerialization to SerializerTest --- .../chronicle/map/CHMUseCasesTest.java | 26 ++++--------------- .../openhft/chronicle/map/SerializerTest.java | 16 ++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java index f3805d707..9a71515e1 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java +++ b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java @@ -63,7 +63,7 @@ public class CHMUseCasesTest { } - private static class PrefixStingFunction implements Function { + static class PrefixStingFunction implements Function { private final String prefix; public PrefixStingFunction(@NotNull String prefix) { @@ -109,21 +109,6 @@ public class CHMUseCasesTest { } - @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); - - } - @Test public void testStringStringMap() throws ExecutionException, InterruptedException, IOException { @@ -447,7 +432,7 @@ public class CHMUseCasesTest { @Test(expected = IllegalStateException.class) - public void testAquireUsingWithIntValueNoValue() throws IOException { + public void testAcquireUsingWithIntValueNoValue() throws IOException { if (typeOfMap == TypeOfMap.STATELESS) throw new IllegalStateException(); // acquireUsingLocked supported by the STATELESS @@ -472,7 +457,7 @@ public class CHMUseCasesTest { @Test(expected = IllegalArgumentException.class) - public void testAquireUsingImutableUsing() throws IOException { + public void testAcquireUsingImmutableUsing() throws IOException { if (typeOfMap == TypeOfMap.STATELESS) throw new IllegalArgumentException(); // acquireUsingLocked supported by the STATELESS @@ -567,15 +552,14 @@ public class CHMUseCasesTest { key.setValue(1); ByteBufferBytes value = new ByteBufferBytes(ByteBuffer.allocate(10)); - value.clear(); + value.limit(0); try (WriteContext rc = map.acquireUsingLocked(key, value)) { assertTrue(key instanceof IntValue); assertTrue(value instanceof CharSequence); - value.limit(value.position()); } - assertTrue( map.get(key).length() == 0); + assertTrue(map.get(key).length() == 0); } } diff --git a/src/test/java/net/openhft/chronicle/map/SerializerTest.java b/src/test/java/net/openhft/chronicle/map/SerializerTest.java index 53543409d..3878037f6 100644 --- a/src/test/java/net/openhft/chronicle/map/SerializerTest.java +++ b/src/test/java/net/openhft/chronicle/map/SerializerTest.java @@ -29,8 +29,24 @@ import java.io.*; import java.nio.ByteBuffer; import java.util.Collections; +import static org.junit.Assert.assertEquals; + public class SerializerTest { + @Test + public void testPrefixStingFunctionSerialization() throws Exception { + + ByteBufferBytes b = new ByteBufferBytes(ByteBuffer.allocate(512)); + + CHMUseCasesTest.PrefixStingFunction expected = new CHMUseCasesTest.PrefixStingFunction("New "); + b.writeObject(expected); + + b.clear(); + CHMUseCasesTest.PrefixStingFunction actual = b.readObject(CHMUseCasesTest.PrefixStingFunction.class); + assertEquals(expected, actual); + + } + @Test public void testValueMarshallable() throws Exception { testReadWriteValue("Test");