Add junit coverage to MetadataCacheFactory class
[appc.git] / appc-core / appc-common-bundle / src / test / java / org / onap / appc / cache / impl / MetadataCacheFactoryTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * ================================================================================
9  * Modificiations (C) 2019 Ericsson
10  * =============================================================================
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  * 
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  * 
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  * 
23  * ============LICENSE_END=========================================================
24  */
25
26 package org.onap.appc.cache.impl;
27
28 import org.junit.Assert;
29 import org.junit.Test;
30 import org.onap.appc.cache.CacheStrategies;
31 import org.powermock.reflect.Whitebox;
32
33 public class MetadataCacheFactoryTest {
34
35     @Test
36     public void testConstructor() throws Exception {
37         Whitebox.invokeConstructor(MetadataCacheFactory.class);
38     }
39
40     @Test
41     public void testGetInstance() throws Exception {
42         Assert.assertTrue("Should not return null", MetadataCacheFactory.getInstance() != null);
43         Assert.assertEquals("Should always return the same object",
44                 MetadataCacheFactory.getInstance(), MetadataCacheFactory.getInstance());
45     }
46
47     @Test
48     public void testGetMetadataCacheWithNoArgument() throws Exception {
49         Assert.assertNotNull(MetadataCacheFactory.getInstance().getMetadataCache());
50     }
51
52     @Test
53     public void testGetMetadataCacheWithArgument() throws Exception {
54         CacheStrategies cacheStrategies = CacheStrategies.LRU;
55         Assert.assertNotNull(MetadataCacheFactory.getInstance().getMetadataCache(cacheStrategies));
56     }
57 }