HCOLL-250 providing better error message for failure and attempts to create using reflection

This commit is contained in:
Rob Austin
2014-12-15 12:05:19 +00:00
parent 84a77e89f5
commit 76cbbc19ff
4 changed files with 70 additions and 9 deletions
@@ -332,8 +332,8 @@ public class CHMUseCasesTest {
}
}
@Ignore("HCOLL-250 map.newKeyInstance() throws NPE for simple types like Long")
@Test
@Test(expected = IllegalStateException.class)
public void testLongNewKeyValueInstance() {
try (ChronicleMap map = ChronicleMapBuilder
.of(Long.class, Long.class)
@@ -344,6 +344,42 @@ public class CHMUseCasesTest {
}
}
@Test(expected = IllegalStateException.class)
public void testNewKeyValueInstanceWithMapType() {
try (ChronicleMap map = ChronicleMapBuilder
.of(Map.class, Map.class)
.create()) {
map.newKeyInstance();
map.newValueInstance();
}
}
@Test
public void testNewKeyValueInstanceWithHahMapType() {
try (ChronicleMap map = ChronicleMapBuilder
.of(HashMap.class, HashMap.class)
.create()) {
map.newKeyInstance();
map.newValueInstance();
}
}
@Test(expected = IllegalStateException.class)
public void testNewKeyValueInstanceWithByteArray() {
try (ChronicleMap map = ChronicleMapBuilder
.of(byte[].class, byte[].class)
.create()) {
map.newKeyInstance();
map.newValueInstance();
}
}
/**
* StringValue represents any bean which contains a String Value
*/