mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
added tests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import net.openhft.lang.io.ByteBufferBytes;
|
||||
import net.openhft.lang.io.serialization.impl.*;
|
||||
import net.openhft.lang.values.*;
|
||||
@@ -82,6 +83,34 @@ public class CHMUseCasesTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCharSequenceMixingKeyTypes() throws ExecutionException, InterruptedException {
|
||||
|
||||
try (ChronicleMap<CharSequence, CharSequence> map = ChronicleMapBuilder
|
||||
.of(CharSequence.class, CharSequence.class) // for testing purposes only
|
||||
.create()) {
|
||||
map.put("Hello", "World");
|
||||
map.put(new StringBuilder("Hello"), "World2");
|
||||
|
||||
Assert.assertEquals("World2", map.get("Hello"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCharSequenceMixingValueTypes() throws ExecutionException, InterruptedException {
|
||||
|
||||
try (ChronicleMap<CharSequence, CharSequence> map = ChronicleMapBuilder
|
||||
.of(CharSequence.class, CharSequence.class) // for testing purposes only
|
||||
.create()) {
|
||||
map.put("Hello", "World");
|
||||
map.put("Hello2", new StringBuilder("World2"));
|
||||
|
||||
Assert.assertEquals("World2", map.get("Hello2"));
|
||||
Assert.assertEquals("World", map.get("Hello"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CharSequence is more efficient when object creation is avoided. The key can only be on heap
|
||||
* and variable length serialised.
|
||||
|
||||
Reference in New Issue
Block a user