436acd97890456158ea5dceda1f794a19d66695e
[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 public class NeutronVPNLifetimeJAXBTest {
15
16     private static final String NeutronVPNLifetimeTest_sourceJson = "{" +
17         "\"units\": \"seconds\", " +
18         "\"value\": 3600 }";
19
20     @Test
21     public void test_NeutronVPNLifetime_JAXB() {
22         NeutronVPNLifetime dummyObject = new NeutronVPNLifetime();
23         try {
24             NeutronVPNLifetime testObject = (NeutronVPNLifetime) JaxbTestHelper.jaxbUnmarshall(dummyObject, NeutronVPNLifetimeTest_sourceJson);
25             Assert.assertEquals("NeutronVPNLifetime JAXB Test 1: Testing units failed",
26                   "seconds", testObject.getUnits());
27
28             Assert.assertEquals("NeutronVPNLifetime JAXB Test 2: Testing value failed",
29                   new Integer(3600), testObject.getValue());
30         } catch (Exception e) {
31             Assert.fail("Tests failed");
32         }
33     }
34 }