e3133cb1c693462804178cdaee7800e9c8cd5d93
[so.git] / bpmn / MSOCoreBPMN / src / test / java / org / onap / so / bpmn / core / domain / LicenseTest.java
1 /*
2 * ============LICENSE_START=======================================================
3  * ONAP : SO
4  * ================================================================================
5  * Copyright (C) 2018 TechMahindra
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19 */
20 package org.onap.so.bpmn.core.domain;
21
22
23 import static org.junit.Assert.assertArrayEquals;
24 import static org.junit.Assert.assertEquals;
25
26 import java.util.ArrayList;
27 import java.util.List;
28
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.mockito.BDDMockito.Then;
33 import org.mockito.InjectMocks;
34 import org.mockito.Mock;
35 import org.powermock.api.mockito.PowerMockito;
36 import org.powermock.core.classloader.annotations.PrepareForTest;
37 import org.powermock.modules.junit4.PowerMockRunner;
38
39
40 //@RunWith(PowerMockRunner.class)
41 //@PrepareForTest({License.class})
42 public class LicenseTest {
43         
44         //@Mock
45         private License license= new License();
46         //@InjectMocks
47         //private LicenseTest licenceTest;
48         List<String> entitlementPoolList = new ArrayList<String>();
49         private List<String> licenseKeyGroupList = new ArrayList<String>();
50         //JSONArray array = new JSONArray(entitlementPoolList);
51         //JSONArray array1 = new JSONArray(licenseKeyGroupList);
52         //@PrepareForTest({License.class})
53         Long serialVersionUID = 333L;
54         
55         @Test
56         public void testLicense() {
57                 license.setEntitlementPoolList(entitlementPoolList);
58                 license.setLicenseKeyGroupList(licenseKeyGroupList);
59                 //license.addEntitlementPool("entitlementPoolUuid");
60                 license.addLicenseKeyGroup("licenseKeyGroupUuid");
61                 assertEquals(license.getEntitlementPoolList(), entitlementPoolList);
62                 assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList);
63                 assert(license.getEntitlementPoolListAsString()!= null);
64                 assert(license.getLicenseKeyGroupListAsString()!=null);
65                 license.addEntitlementPool("entitlementPoolUuid");
66                 //assertEquals(license.getSerialversionuid(), serialVersionUID);
67                 //assertArrayEquals(license.getSerialversionuid(), serialVersionUID);
68                 //assert
69         
70                 /*PowerMockito.mockStatic(License.class);
71                 Mockito.when(License.getSerialversionuid()).thenReturn(getserial());
72                 assertEquals(License.getSerialversionuid(),"abc");*/
73                 
74         }
75         // @Before 
76         // public void mocksetUp() {
77 //      Long serialVersionUID = 333L;
78 //            PowerMockito.mockStatic(License.class);
79 //            expect (license.getSerialversionuid()).andReturn(serialVersionUID);
80 //            //PowerMockito.when(license.getSerialversionuid().
81 //            //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1);
82 //         }
83         
84         /*private Long getserial() {
85                 
86                 return abc;
87         }*/
88
89 }