/*
 * Copyright 2018 Crown Copyright
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package stroom.pipeline.refdata.store.offheapstore.serdes;


import org.junit.jupiter.api.Test;
import stroom.pipeline.refdata.store.FastInfosetValue;
import stroom.pipeline.refdata.store.StringValue;
import stroom.pipeline.refdata.store.offheapstore.ValueStoreMeta;

class TestValueStoreMetaSerde extends AbstractSerdeTest<ValueStoreMeta, ValueStoreMetaSerde> {

    @Test
    void testSerializeDeserialize() {
        final ValueStoreMeta valueStoreMeta = new ValueStoreMeta(FastInfosetValue.TYPE_ID, 123);

        doSerialisationDeserialisationTest(valueStoreMeta, ValueStoreMetaSerde::new);
    }

    @Test
    void testExtractTypeId() {

        ValueStoreMeta valueStoreMeta = new ValueStoreMeta(StringValue.TYPE_ID, 123);
        doExtractionTest(valueStoreMeta, getSerde()::extractTypeId, ValueStoreMeta::getTypeId);
    }

    @Test
    void testExtractReferenceCount() {

        ValueStoreMeta valueStoreMeta = new ValueStoreMeta(StringValue.TYPE_ID, 123);
        doExtractionTest(valueStoreMeta, getSerde()::extractReferenceCount, ValueStoreMeta::getReferenceCount);
    }

    @Override
    Class<ValueStoreMetaSerde> getSerdeType() {
        return ValueStoreMetaSerde.class;
    }
}
@@ -661,43 +661,8 @@
 ;%0A%0A%0A
-import org.junit.jupiter.api.Test;%0A
 impo
@@ -708,24 +708,24 @@
 fosetValue;%0A
+
 import stroo
@@ -829,16 +829,121 @@
 eMeta;%0A%0A
+import org.assertj.core.api.Assertions;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport java.nio.ByteBuffer;%0A%0A
 class Te
@@ -1628,32 +1628,32 @@
 .TYPE_ID, 123);%0A
-
         doExtrac
@@ -1751,24 +1751,1260 @@
 nt);%0A    %7D%0A%0A
+    @Test%0A    void testIncrementRefCount() %7B%0A        final ValueStoreMeta valueStoreMeta = new ValueStoreMeta(StringValue.TYPE_ID, 123);%0A        final ByteBuffer byteBuffer = ByteBuffer.allocate(20);%0A%0A        getSerde().serialize(byteBuffer, valueStoreMeta);%0A%0A        final ByteBuffer newBuffer = ByteBuffer.allocate(20);%0A%0A        getSerde().cloneAndIncrementRefCount(byteBuffer, newBuffer);%0A%0A        final ValueStoreMeta valueStoreMeta2 = getSerde().deserialize(newBuffer);%0A%0A        Assertions.assertThat(valueStoreMeta2.getReferenceCount())%0A                .isEqualTo(valueStoreMeta.getReferenceCount() + 1);%0A    %7D%0A%0A    @Test%0A    void testDecrementRefCount() %7B%0A        final ValueStoreMeta valueStoreMeta = new ValueStoreMeta(StringValue.TYPE_ID, 123);%0A        final ByteBuffer byteBuffer = ByteBuffer.allocate(20);%0A%0A        getSerde().serialize(byteBuffer, valueStoreMeta);%0A%0A        final ByteBuffer newBuffer = ByteBuffer.allocate(20);%0A%0A        getSerde().cloneAndDecrementRefCount(byteBuffer, newBuffer);%0A%0A        final ValueStoreMeta valueStoreMeta2 = getSerde().deserialize(newBuffer);%0A%0A        Assertions.assertThat(valueStoreMeta2.getReferenceCount())%0A                .isEqualTo(valueStoreMeta.getReferenceCount() - 1);%0A    %7D%0A%0A
     @Overrid

Add test to TestValueStoreMetaSerde