2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.so.bpmn.core.domain;
23 import static org.junit.Assert.assertArrayEquals;
24 import static org.junit.Assert.assertEquals;
26 import java.util.ArrayList;
27 import java.util.List;
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;
40 //@RunWith(PowerMockRunner.class)
41 //@PrepareForTest({License.class})
42 public class LicenseTest {
45 private License license= new License();
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;
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);
70 /*PowerMockito.mockStatic(License.class);
71 Mockito.when(License.getSerialversionuid()).thenReturn(getserial());
72 assertEquals(License.getSerialversionuid(),"abc");*/
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);
84 /*private Long getserial() {