Add more serialization assertions
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / concepts / MemberNameTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, 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.controller.cluster.access.concepts;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import org.junit.Test;
14
15 public class MemberNameTest extends AbstractIdentifierTest<MemberName> {
16     private static final MemberName OBJECT = MemberName.forName("test1");
17     private static final MemberName DIFFERENT_OBJECT = MemberName.forName("test2");
18     private static final MemberName EQUAL_OBJECT = MemberName.forName("test1");
19
20     @Override
21     MemberName object() {
22         return OBJECT;
23     }
24
25     @Override
26     MemberName differentObject() {
27         return DIFFERENT_OBJECT;
28     }
29
30     @Override
31     MemberName equalObject() {
32         return EQUAL_OBJECT;
33     }
34
35     @Override
36     int expectedSize() {
37         return 101;
38     }
39
40     @Test
41     public void testCompareTo() {
42         assertEquals(0, object().compareTo(object()));
43         assertEquals(0, object().compareTo(equalObject()));
44         assertTrue(object().compareTo(differentObject()) < 0);
45         assertTrue(differentObject().compareTo(object()) > 0);
46     }
47
48     @Test
49     public void testGetName() {
50         assertEquals("test1", OBJECT.getName());
51     }
52 }