Drop JMock usage from unit tests
[lispflowmapping.git] / mappingservice / lisp-proto / src / test / java / org / opendaylight / lispflowmapping / serializer / address / Ipv6SerializerTest.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.lispflowmapping.serializer.address;
9
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
15 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.Ipv6BinaryAfi;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6Binary;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
19
20 public class Ipv6SerializerTest {
21
22     @Test
23     public void constructor__Name() throws Exception {
24         Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:0");
25
26         assertEquals(Ipv6BinaryAfi.VALUE, rloc.getAddressType());
27         assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
28         assertArrayEquals(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
29                 ((Ipv6Binary) rloc.getAddress()).getIpv6Binary().getValue());
30     }
31
32     @Test
33     public void constructor__Buffer() throws Exception {
34         Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1");
35
36         assertEquals(Ipv6BinaryAfi.VALUE, rloc.getAddressType());
37         assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
38         assertArrayEquals(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
39                 ((Ipv6Binary) rloc.getAddress()).getIpv6Binary().getValue());
40     }
41 }