ARTEMIS-1847 Fix test after netty upgrade

Missing call to resetReadIndex causes IndexOutOfBoundsException after
netty fixed to correctly throw on vilation of the contract.
This commit is contained in:
Timothy Bish 2018-05-03 14:47:55 -04:00
parent 2ea4d1c8bf
commit 8f4b1a6c18
1 changed files with 4 additions and 2 deletions

View File

@ -20,8 +20,6 @@ import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
@ -30,6 +28,9 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class TypedPropertiesTest { public class TypedPropertiesTest {
private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual) { private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual) {
@ -246,6 +247,7 @@ public class TypedPropertiesTest {
final TypedProperties.StringValue expectedPooled = pool.getOrCreate(bb); final TypedProperties.StringValue expectedPooled = pool.getOrCreate(bb);
bb.resetReaderIndex(); bb.resetReaderIndex();
Assert.assertSame(expectedPooled, pool.getOrCreate(bb)); Assert.assertSame(expectedPooled, pool.getOrCreate(bb));
bb.resetReaderIndex();
} }
} }