blob: c3568775033cafd73dbb5f27e084620caa7f082b [file] [log] [blame]
Dhruv Dhodyb5850122016-02-17 17:51:19 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Dhruv Dhodyb5850122016-02-17 17:51:19 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ospf.controller.impl;
17
18
19import org.easymock.EasyMock;
Dhruv Dhodyb5850122016-02-17 17:51:19 +053020import org.jboss.netty.channel.Channel;
21import org.jboss.netty.channel.ChannelHandlerContext;
22import org.junit.After;
23import org.junit.Before;
24import org.junit.Test;
Dhruv Dhodyb5850122016-02-17 17:51:19 +053025
26import static org.hamcrest.CoreMatchers.is;
27import static org.hamcrest.CoreMatchers.notNullValue;
28import static org.hamcrest.MatcherAssert.assertThat;
29
30/**
31 * Created by sdn on 13/1/16.
32 */
33public class OspfMessageEncoderTest {
sunishvkf7c56552016-07-18 16:02:39 +053034
35 private final byte[] object = {2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39,
36 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0,
37 0, 40, -64, -88, -86, 8, 0, 0, 0, 0};
Dhruv Dhodyb5850122016-02-17 17:51:19 +053038 private OspfMessageEncoder ospfMessageEncoder;
sunishvkf7c56552016-07-18 16:02:39 +053039 private ChannelHandlerContext channelHandlerContext;
Dhruv Dhodyb5850122016-02-17 17:51:19 +053040 private Channel channel;
41
42 @Before
43 public void setUp() throws Exception {
44 ospfMessageEncoder = new OspfMessageEncoder();
sunishvkf7c56552016-07-18 16:02:39 +053045 channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
46 channel = EasyMock.createMock(Channel.class);
Dhruv Dhodyb5850122016-02-17 17:51:19 +053047 }
48
49 @After
50 public void tearDown() throws Exception {
Dhruv Dhodyb5850122016-02-17 17:51:19 +053051 ospfMessageEncoder = null;
Dhruv Dhodyb5850122016-02-17 17:51:19 +053052 }
53
54 /**
55 * Tests encode() method.
56 */
57 @Test
58 public void testEncode() throws Exception {
sunishvkf7c56552016-07-18 16:02:39 +053059 assertThat(ospfMessageEncoder.encode(channelHandlerContext, channel, object), is(notNullValue()));
Dhruv Dhodyb5850122016-02-17 17:51:19 +053060 }
61}