Merge "Changed codec for Identityref in JSON transformation"
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / implementation / src / test / java / org / opendaylight / controller / sal / connector / remoterpc / RouteIdentifierImplTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  * This program and the accompanying materials are made available under the
4  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/epl-v10.html
6  */
7
8 package org.opendaylight.controller.sal.connector.remoterpc;
9
10 import java.net.URI;
11
12 import com.fasterxml.jackson.core.JsonParseException;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.controller.sal.connector.remoterpc.dto.RouteIdentifierImpl;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 public class RouteIdentifierImplTest {
21
22   Logger _logger = LoggerFactory.getLogger(RouteIdentifierImplTest.class);
23
24   private final URI namespace = URI.create("http://cisco.com/example");
25   private final QName QNAME = new QName(namespace, "heartbeat");
26
27   @Test
28   public void testToString() throws Exception {
29     RouteIdentifierImpl rId = new RouteIdentifierImpl();
30     rId.setType(QNAME);
31
32     _logger.debug(rId.toString());
33
34     Assert.assertTrue(true);
35
36   }
37
38   @Test
39   public void testFromString() throws Exception {
40     RouteIdentifierImpl rId = new RouteIdentifierImpl();
41     rId.setType(QNAME);
42
43     _logger.debug("route: " + rId.fromString(rId.toString()));
44
45     Assert.assertTrue(true);
46   }
47
48   @Test(expected = JsonParseException.class)
49   public void testFromInvalidString() throws Exception {
50     String invalidInput = "aklhdgadfa;;;;;;;]]]]=]ag" ;
51     RouteIdentifierImpl rId = new RouteIdentifierImpl();
52     rId.fromString(invalidInput);
53
54     _logger.debug("" + rId);
55     Assert.assertTrue(true);
56   }
57 }