add unit tests for crossconnect package
[transportpce.git] / common / src / test / java / org / opendaylight / transportpce / common / fixedflex / FixedFlexImplTest.java
1 /*
2  * Copyright © 2020 Orange.  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.transportpce.common.fixedflex;
10
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Test;
14
15 public class FixedFlexImplTest {
16
17     FixedFlexImpl fixedFlex = null;
18
19     @Before
20     public void setUp() {
21         fixedFlex = new FixedFlexImpl();
22     }
23
24     @Test
25     public void getFixedFlexWaveMappingTest() {
26         FixedFlexImpl res = fixedFlex.getFixedFlexWaveMapping(10L);
27
28         Assert.assertEquals(res.getIndex(),10);
29         Assert.assertEquals(res.getCenterFrequency(),195.65,.5);
30         Assert.assertEquals(res.getStart(),195.625,.5);
31         Assert.assertEquals(res.getStop(),195.675,.5);
32         Assert.assertEquals(res.getWavelength(),1532.37,.5);
33     }
34
35     @Test
36     public void fixedFlexImpl1() {
37         FixedFlexImpl res = new FixedFlexImpl(10L);
38
39         Assert.assertEquals(res.getIndex(),0);
40         Assert.assertEquals(res.getCenterFrequency(),195.65,.5);
41         Assert.assertEquals(res.getStart(),195.625,.5);
42         Assert.assertEquals(res.getStop(),195.675,.5);
43         Assert.assertEquals(res.getWavelength(),1532.37,.5);
44     }
45
46     @Test
47     public void fixedFlexImpl2() {
48         FixedFlexImpl res = new FixedFlexImpl(1L, 19, 19, 19, 12);
49
50         Assert.assertEquals(res.getIndex(),1L);
51         Assert.assertEquals(res.getCenterFrequency(),19,.5);
52         Assert.assertEquals(res.getStart(),19,.5);
53         Assert.assertEquals(res.getStop(),19,.5);
54         Assert.assertEquals(res.getWavelength(),12,.5);
55     }
56 }