-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterMessageFactoryTest {\r
-\r
- @Mock DeserializerRegistry registry;\r
- @Mock OFDeserializer<ExperimenterMessage> deserializer;\r
- @Mock ExperimenterMessage message;\r
-\r
- /**\r
- * Initializes mocks\r
- */\r
- @Before\r
- public void startUp() {\r
- MockitoAnnotations.initMocks(this);\r
- }\r
-\r
- /**\r
- * Test deserializer lookup correctness\r
- */\r
- @Test\r
- public void test() {\r
- when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);\r
- when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);\r
- \r
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");\r
- ExperimenterMessageFactory factory = new ExperimenterMessageFactory();\r
- factory.injectDeserializerRegistry(registry);\r
- ExperimenterMessage deserializedMessage = factory.deserialize(buffer);\r
- Assert.assertEquals("Wrong return value", message, deserializedMessage);\r
- Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());\r
- }\r
+/*
+ * 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 static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterMessageFactoryTest {
+
+ @Mock DeserializerRegistry registry;
+ @Mock OFDeserializer<ExperimenterMessage> deserializer;
+ @Mock ExperimenterMessage message;
+
+ /**
+ * Initializes mocks
+ */
+ @Before
+ public void startUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ /**
+ * Test deserializer lookup correctness
+ */
+ @Test
+ public void test() {
+ when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);
+ when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);
+
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");
+ ExperimenterMessageFactory factory = new ExperimenterMessageFactory();
+ factory.injectDeserializerRegistry(registry);
+ ExperimenterMessage deserializedMessage = factory.deserialize(buffer);
+ Assert.assertEquals("Wrong return value", message, deserializedMessage);
+ Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());
+ }
}
\ No newline at end of file