aboutsummaryrefslogtreecommitdiffstats
path: root/appc-core/appc-common-bundle
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-01-11 15:18:03 +0000
committerJoss Armstrong <joss.armstrong@ericsson.com>2019-01-11 15:18:12 +0000
commit0278639c0db548c54c81aecd1cce8b05f2c5a6dd (patch)
tree90b403e60a16d77b782cf0f23f398763d53d6004 /appc-core/appc-common-bundle
parenta1482e86dfea4360b1d8338ca7a0f1c5dee52b1a (diff)
Fix unit test with @PrepareForTest annotation
Removed annotation and fixed tests. Increased package line coverage from 50% to 88% Issue-ID: APPC-1323 Change-Id: Iae5441e5e6243755f8ec6ab178668a5c985eaf6a Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-core/appc-common-bundle')
-rw-r--r--appc-core/appc-common-bundle/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java25
1 files changed, 3 insertions, 22 deletions
diff --git a/appc-core/appc-common-bundle/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java b/appc-core/appc-common-bundle/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
index 9f2d1a05c..26a5b3596 100644
--- a/appc-core/appc-common-bundle/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
+++ b/appc-core/appc-common-bundle/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modificiations (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,18 +25,15 @@
package org.onap.appc.cache.impl;
-import static org.mockito.Mockito.mock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.appc.cache.CacheStrategies;
-import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
@RunWith(PowerMockRunner.class)
-@PrepareForTest({MetadataCacheFactory.class, MetadataCacheImpl.class})
+@PrepareForTest(MetadataCacheImpl.class)
public class MetadataCacheFactoryTest {
@Test
public void testConstructor() throws Exception {
@@ -47,22 +46,4 @@ public class MetadataCacheFactoryTest {
Assert.assertEquals("Should always return the same object",
MetadataCacheFactory.getInstance(), MetadataCacheFactory.getInstance());
}
-
- @Test
- public void testGetMetadataCacheWithNoArgument() throws Exception {
- MetadataCacheImpl mockImpl = mock(MetadataCacheImpl.class);
- PowerMockito.whenNew(MetadataCacheImpl.class).withNoArguments().thenReturn(mockImpl);
- Assert.assertEquals(mockImpl, MetadataCacheFactory.getInstance().getMetadataCache());
- }
-
- @Test
- public void testGetMetadataCacheWithArgument() throws Exception {
- CacheStrategies cacheStrategies = CacheStrategies.LRU;
- MetadataCacheImpl mockImpl = mock(MetadataCacheImpl.class);
- PowerMockito.whenNew(MetadataCacheImpl.class).withArguments(cacheStrategies)
- .thenReturn(mockImpl);
- Assert.assertEquals(mockImpl,
- MetadataCacheFactory.getInstance().getMetadataCache(cacheStrategies));
- }
-
}