X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Ffactories%2FVendorMessageFactoryTest.java;h=0c9707caa548b2984cff82a1ab8e757f4234022c;hb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;hp=d293efcb2749707d27e5b441893123af145e997b;hpb=9a0a2899b730e740cdaae425f7d5dd7027dfa1d1;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java index d293efcb..0c9707ca 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java @@ -1,48 +1,48 @@ -/* - * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.openflowjava.protocol.impl.deserialization.factories; - -import io.netty.buffer.ByteBuf; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; -import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey; -import org.opendaylight.openflowjava.util.ByteBufUtils; - -/** - * @author michal.polkorab - * - */ -@RunWith(MockitoJUnitRunner.class) -public class VendorMessageFactoryTest { - - @Mock DeserializerRegistry registry; - @Mock ExperimenterMessageFactory deserializer; - - /** - * Tests {@link VendorMessageFactory#deserialize(ByteBuf)} - */ - @Test - public void test() { - Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer); - ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00"); - VendorMessageFactory factory = new VendorMessageFactory(); - factory.injectDeserializerRegistry(registry); - factory.deserialize(buffer); - - Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer); - Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes()); - } +/* + * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.openflowjava.protocol.impl.deserialization.factories; + +import io.netty.buffer.ByteBuf; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; +import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey; +import org.opendaylight.openflowjava.util.ByteBufUtils; + +/** + * @author michal.polkorab + * + */ +@RunWith(MockitoJUnitRunner.class) +public class VendorMessageFactoryTest { + + @Mock DeserializerRegistry registry; + @Mock ExperimenterMessageFactory deserializer; + + /** + * Tests {@link VendorMessageFactory#deserialize(ByteBuf)} + */ + @Test + public void test() { + Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer); + ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00"); + VendorMessageFactory factory = new VendorMessageFactory(); + factory.injectDeserializerRegistry(registry); + factory.deserialize(buffer); + + Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer); + Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes()); + } } \ No newline at end of file