summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-02-23 16:38:16 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-02-25 15:10:39 +0000
commit058fdf8229ef1cfc82bbad223e885ae6afdc78d0 (patch)
tree9435736fd4c1114b11e02f5ebf2a5e31579f642e /catalog-be/src/test
parent6ac7274a7149f03eb464c94a3c2c1132feb04818 (diff)
Fix bugs introduced by new code
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Ide809e2e83b3f620dd1f173266edbe94967454f5 Issue-ID: SDC-3475
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java25
2 files changed, 15 insertions, 16 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
index 22f5de64d5..52d8ce976d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
@@ -144,6 +144,8 @@ class ExternalRefServletTest extends JerseyTest {
System.currentTimeMillis());
@Mock
+ private IdMapper idMapper;
+ @Mock
public WebAppContextWrapper webAppContextWrapper;
@Mock
private ServletContext servletContext;
@@ -182,7 +184,6 @@ class ExternalRefServletTest extends JerseyTest {
@BeforeAll
public void setup() {
- MockitoAnnotations.initMocks(this);
//Needed for User Authorization
//========================================================================================================================
@@ -238,6 +239,7 @@ class ExternalRefServletTest extends JerseyTest {
@BeforeEach
public void before() throws Exception {
super.setUp();
+ MockitoAnnotations.openMocks(this);
when(resourceComponentMock.getVersion()).thenReturn(VERSION);
when(resourceComponentMock.getUniqueId()).thenReturn(resourceVertexUuid);
@@ -663,8 +665,6 @@ class ExternalRefServletTest extends JerseyTest {
private GraphVertex resourceVertex;
private ExternalReferencesOperation externalReferenceOperation;
private HealingJanusGraphDao janusGraphDao;
- @Mock
- private IdMapper idMapper;
@Bean
ExternalRefsServlet externalRefsServlet() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 2b00668a74..4b55a730fb 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -360,7 +360,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
componentInstanceList.add(ci);
component.setComponentInstances(componentInstanceList);
- when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(component));
Either<ImmutablePair<ToscaTemplate, Map<String, Component>>, ToscaError> result;
result = Deencapsulation.invoke(testSubject, "fillImports", component, toscaTemplate);
@@ -368,11 +368,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
verify(toscaOperationFacade, times(1)).getToscaFullElement("name");
Assert.assertTrue(result.isLeft());
ToscaTemplate toscaTemplateRes = result.left().value().left;
- Assert.assertTrue(toscaTemplateRes.getImports().size() == 8);
+ Assert.assertEquals(8 , toscaTemplateRes.getImports().size());
Assert.assertNotNull(toscaTemplateRes.getImports().get(6).get("resource-TestResourceName-interface"));
Assert.assertNotNull(toscaTemplateRes.getImports().get(7).get("resource-TestResourceName"));
- Assert.assertTrue(toscaTemplateRes.getDependencies().size() == 1);
- Assert.assertNotNull(toscaTemplateRes.getDependencies().get(0).getLeft().equals("name.name2"));
+ Assert.assertEquals(1 , toscaTemplateRes.getDependencies().size());
+ Assert.assertEquals("name.name2",toscaTemplateRes.getDependencies().get(0).getLeft());
}
@Test
@@ -530,10 +530,9 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
ci.setOriginType(OriginTypeEnum.ServiceProxy);
ci.setSourceModelUid("modelName");
- when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(component));
- when(toscaOperationFacade.getToscaFullElement(eq("modelName")))
- .thenReturn(Either.left(new Service()));
+ when(toscaOperationFacade.getToscaFullElement("modelName")).thenReturn(Either.left(new Service()));
// default test
Deencapsulation.invoke(testSubject, "createDependency", componentCache, imports, dependecies, ci);
@@ -1486,7 +1485,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// test return false
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
reqAndRelationshipPair, requirement, fromInstanceId);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1501,7 +1500,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// default test return true
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
reqAndRelationshipPair, requirement, fromInstanceId);
- Assert.assertNotNull(result);
+ Assert.assertTrue(result);
}
@Test
@@ -1519,7 +1518,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
// default test
result = Deencapsulation.invoke(testSubject, "isRequirementBelongToOwner", reqAndRelationshipPair, requirement,
fromInstanceId, originComponent);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1531,7 +1530,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
component = new Service();
result = Deencapsulation.invoke(testSubject, "isCvfc", component);
- Assert.assertNotNull(result);
+ Assert.assertFalse(result);
}
@Test
@@ -1577,8 +1576,8 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
result = Deencapsulation.invoke(testSubject, "convertToNodeTemplateArtifacts", container);
Assert.assertNotNull(result);
Assert.assertTrue(MapUtils.isNotEmpty(result));
- Assert.assertTrue(result.get("test_art").getFile().equals("test_file"));
- Assert.assertTrue(result.get("test_art").getType().equals("test_type"));
+ Assert.assertEquals("test_file",result.get("test_art").getFile());
+ Assert.assertEquals("test_type",result.get("test_art").getType());
}
@Test