0dc825ea408efbfefa7491c34439022a2f93d582
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronVPNLifetimeJAXBTest.java
1 /*
2  * Copyright (c) 2015 Tata Consultancy Services.  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
9 package org.opendaylight.neutron.spi;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13
14 import org.opendaylight.neutron.spi.NeutronVPNLifetime;
15
16 public class NeutronVPNLifetimeJAXBTest {
17
18     private static final String NeutronVPNLifetimeTest_sourceJson = "{" +
19         "\"units\": \"seconds\", " +
20         "\"value\": 3600 }";
21
22     @Test
23     public void test_NeutronVPNLifetime_JAXB() {
24         NeutronVPNLifetime dummyObject = new NeutronVPNLifetime();
25         try {
26             NeutronVPNLifetime testObject = (NeutronVPNLifetime) JaxbTestHelper.jaxbUnmarshall(dummyObject, NeutronVPNLifetimeTest_sourceJson);
27             Assert.assertEquals("NeutronVPNLifetime JAXB Test 1: Testing units failed",
28                   "seconds", testObject.getUnits());
29
30             Assert.assertEquals("NeutronVPNLifetime JAXB Test 2: Testing value failed",
31                   new Integer(3600), testObject.getValue());
32         } catch (Exception e) {
33             Assert.fail("Tests failed");
34         }
35     }
36 }