[ https://issues.apache.org/jira/browse/GEODE-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15059168#comment-15059168 ]
ASF GitHub Bot commented on GEODE-651: -------------------------------------- Github user dschneider-pivotal commented on a diff in the pull request: https://github.com/apache/incubator-geode/pull/60#discussion_r47719822 --- Diff: gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/GemFireChunkFactoryJUnitTest.java --- @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 com.gemstone.gemfire.internal.offheap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.LogWriter; +import com.gemstone.gemfire.internal.cache.EntryEventImpl; +import com.gemstone.gemfire.test.junit.categories.UnitTest; + +@Category(UnitTest.class) +public class GemFireChunkFactoryJUnitTest { + + private MemoryAllocator ma; + + @Before + public void setUp() { + OutOfOffHeapMemoryListener ooohml = mock(OutOfOffHeapMemoryListener.class); + OffHeapMemoryStats stats = mock(OffHeapMemoryStats.class); + LogWriter lw = mock(LogWriter.class); + + ma = SimpleMemoryAllocatorImpl.create(ooohml, stats, lw, 1, OffHeapStorage.MIN_SLAB_SIZE * 1, OffHeapStorage.MIN_SLAB_SIZE); + } + + @After + public void tearDown() { + SimpleMemoryAllocatorImpl.freeOffHeapMemory(); + } + + private GemFireChunk createChunk(Object value) { + byte[] v = EntryEventImpl.serialize(value); + + boolean isSerialized = true; + boolean isCompressed = false; + + GemFireChunk chunk = (GemFireChunk) ma.allocateAndInitialize(v, isSerialized, isCompressed, GemFireChunk.TYPE); + chunk.setSerializedValue(v); --- End diff -- remove the calls to setSerializedValue, setSerialized and setCompressed since allocateAndInitialize call them > Chunk classes need unit tests > ----------------------------- > > Key: GEODE-651 > URL: https://issues.apache.org/jira/browse/GEODE-651 > Project: Geode > Issue Type: Sub-task > Components: offheap > Reporter: Sai Boorlagadda > Assignee: Sai Boorlagadda > > Chunk and its subclasses (GemFireChunk, ChunkWithHeapForm, and > GemFireChunkSlice) need unit tests. > GemFireChunkFactory needs a unit test. -- This message was sent by Atlassian JIRA (v6.3.4#6332)