@@ -0,0 +1,2939 @@
+/*%0A * Copyright 2016-2020 Chronicle Software%0A *%0A * https://chronicle.software%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *       http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.openhft.chronicle.map;%0A%0Aimport net.openhft.chronicle.core.pool.ClassAliasPool;%0Aimport net.openhft.chronicle.hash.serialization.impl.MarshallableReaderWriter;%0Aimport net.openhft.chronicle.wire.Marshallable;%0Aimport net.openhft.chronicle.wire.SelfDescribingMarshallable;%0Aimport net.openhft.chronicle.wire.WireOut;%0Aimport net.openhft.chronicle.wire.Wires;%0Aimport org.jetbrains.annotations.NotNull;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.Objects;%0A%0Apublic class MarshallableReaderWriterTest %7B%0A    @Test%0A    public void test() throws IOException %7B%0A        ClassAliasPool.CLASS_ALIASES.addAlias(MyOrder.class);%0A%0A        try (ChronicleMap%3CCharSequence, MyOrder%3E map = ChronicleMap%0A                .of(CharSequence.class, MyOrder.class)%0A                .entries(10)%0A                .valueMarshaller(new MarshallableReaderWriter%3C%3E(MyOrder.class))%0A                .averageKeySize(32)%0A                .averageValueSize(64)%0A                .create()) %7B%0A%0A            final MyOrder myOrder = Marshallable.fromString(%22!MyOrder %7B%5Cn%22 +%0A                    %22  orderId: 123%5Cn%22 +%0A                    %22%7D%5Cn%22);%0A            // Omit %22instrument%22 on purpose to trigger ValueInState.addUnexpected logic%0A%0A            map.put(%221%22, myOrder);%0A%0A            MyOrder retrieved = map.get(%221%22);%0A            Assert.assertEquals(myOrder, retrieved);%0A%0A            retrieved = map.get(%221%22);%0A            Assert.assertEquals(myOrder, retrieved);%0A        %7D%0A    %7D%0A%0A    public static class MyOrder extends SelfDescribingMarshallable %7B%0A        private String instrument;%0A        private String orderId;%0A%0A        @Override%0A        public boolean equals(Object o) %7B%0A            if (this == o) return true;%0A            if (o == null %7C%7C getClass() != o.getClass()) return false;%0A            if (!super.equals(o)) return false;%0A            MyOrder myOrder = (MyOrder) o;%0A            return Objects.equals(instrument, myOrder.instrument) &&%0A                    Objects.equals(orderId, myOrder.orderId);%0A        %7D%0A%0A        @Override%0A        public int hashCode() %7B%0A            return Objects.hash(super.hashCode(), instrument, orderId);%0A        %7D%0A%0A        public void writeMarshallable(@NotNull WireOut wire) %7B%0A            Wires.writeMarshallable(this, wire, false);%0A        %7D%0A    %7D%0A%7D%0A

Fix retrieving empty values with MarshallableReaderWriter, closes https://github.com/OpenHFT/Chronicle-Map/issues/345