mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Small fixes
This commit is contained in:
@@ -48,6 +48,7 @@ public class ThrowablesTest {
|
||||
Throwables.propagateNotWrapping(null, IOException.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testPropagateNotWrappingNullWrappingType() throws Throwable {
|
||||
Throwables.propagateNotWrapping(new IOException(), null);
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.openhft.chronicle.wire.SelfDescribingMarshallable;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public final class AbstractMarshallableKeyValueTest {
|
||||
@@ -31,7 +32,7 @@ public final class AbstractMarshallableKeyValueTest {
|
||||
|
||||
map.put(new Key(), new Value());
|
||||
|
||||
assertThat(map.get(new Key()).number, is(new Value().number));
|
||||
assertEquals(new Value().number, map.get(new Key()).number);
|
||||
}
|
||||
|
||||
private static final class Key extends SelfDescribingMarshallable {
|
||||
|
||||
@@ -22,14 +22,10 @@ import net.openhft.chronicle.bytes.DynamicallySized;
|
||||
import net.openhft.chronicle.bytes.NativeBytesStore;
|
||||
import net.openhft.chronicle.values.Copyable;
|
||||
|
||||
/**
|
||||
* Created by peter.lawrey on 23/04/2015.
|
||||
*/
|
||||
public class DoubleArray implements Byteable, Copyable<DoubleArray>, DynamicallySized {
|
||||
static boolean HACK = true;
|
||||
private static int CAPACITY = 0; // assume a 32-bit size.
|
||||
private static int LENGTH = CAPACITY + 4; // assume a 32-bit size.
|
||||
private static int BASE = LENGTH + 4;
|
||||
private final static int CAPACITY = 0; // assume a 32-bit size.
|
||||
private final static int LENGTH = CAPACITY + 4; // assume a 32-bit size.
|
||||
private final static int BASE = LENGTH + 4;
|
||||
|
||||
private final int capacity;
|
||||
private BytesStore bs;
|
||||
@@ -64,7 +60,7 @@ public class DoubleArray implements Byteable, Copyable<DoubleArray>, Dynamically
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return HACK && bs == null ? 6 * 8 : bs.readInt(LENGTH + offset);
|
||||
return bs == null ? 6 * 8 : bs.readInt(LENGTH + offset);
|
||||
}
|
||||
|
||||
public int capacity() {
|
||||
|
||||
@@ -85,27 +85,4 @@ public class DoubleArrayTest {
|
||||
System.out.println(proxyMap.get(2));
|
||||
proxyMap.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO What is HACK???")
|
||||
public void addToAMap2() {
|
||||
DoubleArray.HACK = false;
|
||||
DoubleArray a = new DoubleArray(10);
|
||||
a.setData(new double[]{1, 2, 3, 4, 5});
|
||||
|
||||
DoubleArray b = new DoubleArray(10);
|
||||
b.setData(new double[]{5, 6, 7, 8, 9});
|
||||
|
||||
ChronicleMap<Integer, DoubleArray> proxyMap = ChronicleMapBuilder
|
||||
.of(Integer.class, DoubleArray.class)
|
||||
.averageValueSize(6 * 8)
|
||||
.create();
|
||||
proxyMap.put(1, a);
|
||||
proxyMap.put(2, b);
|
||||
|
||||
System.out.println(proxyMap.get(1));
|
||||
System.out.println(proxyMap.get(2));
|
||||
proxyMap.close();
|
||||
DoubleArray.HACK = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user