moved testPrefixStingFunctionSerialization to SerializerTest

This commit is contained in:
Rob Austin
2014-12-17 10:01:15 +00:00
parent e4e231bed3
commit 9368e63f3b
2 changed files with 21 additions and 21 deletions
@@ -63,7 +63,7 @@ public class CHMUseCasesTest {
}
private static class PrefixStingFunction implements Function<String, String> {
static class PrefixStingFunction implements Function<String, String> {
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);
}
}
@@ -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");