mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-81 added test for when there is no entry
This commit is contained in:
@@ -71,11 +71,12 @@ public class StatelessClientTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testMapForKey() throws IOException, InterruptedException {
|
||||
public void testMapForKeyWithEntry() throws IOException, InterruptedException {
|
||||
|
||||
|
||||
try (ChronicleMap<Integer, StringBuilder> serverMap = ChronicleMapOnHeapUpdatableBuilder.of(Integer.class,
|
||||
StringBuilder.class)
|
||||
.defaultValue(new StringBuilder())
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
|
||||
serverMap.put(10, new StringBuilder("Hello World"));
|
||||
@@ -84,7 +85,8 @@ public class StatelessClientTest {
|
||||
.class, StringBuilder.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
|
||||
String actual = (String) ((StatelessChronicleMap) statelessMap).mapForKey(10, new StringBuilderToStringFunction());
|
||||
String actual = (String) ((StatelessChronicleMap) statelessMap).mapForKey(10, new
|
||||
StringBuilderToStringFunction());
|
||||
|
||||
Assert.assertEquals("Hello World", actual);
|
||||
}
|
||||
@@ -92,6 +94,30 @@ public class StatelessClientTest {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testMapForKeyWhenNoEntry() throws IOException, InterruptedException {
|
||||
|
||||
|
||||
try (ChronicleMap<Integer, StringBuilder> serverMap = ChronicleMapOnHeapUpdatableBuilder.of(Integer.class,
|
||||
StringBuilder.class)
|
||||
.defaultValue(new StringBuilder())
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
|
||||
serverMap.put(10, new StringBuilder("Hello World"));
|
||||
|
||||
try (ChronicleMap<Integer, StringBuilder> statelessMap = ChronicleMapOnHeapUpdatableBuilder.of(Integer
|
||||
.class, StringBuilder.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
|
||||
String actual = (String) ((StatelessChronicleMap) statelessMap).mapForKey(11, new
|
||||
StringBuilderToStringFunction());
|
||||
|
||||
Assert.assertEquals("", actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 5000)
|
||||
public void testBufferOverFlowPutAllAndEntrySet() throws IOException, InterruptedException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user