re base code
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / path / ForwardingPathBusinessLogicTest.java
@@ -1,14 +1,25 @@
 
-package org.openecomp.sdc.be.components.path;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+package org.openecomp.sdc.be.components.path;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fj.data.Either;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
@@ -21,28 +32,29 @@ import org.openecomp.sdc.exception.ResponseFormat;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 
-import fj.data.Either;
+import static org.junit.Assert.*;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = "/paths/path-context.xml")
-public class ForwardingPathBussinessLogicTest extends BaseForwardingPathTest {
+public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
 
 
     @Test
     public void shouldFailToUpdateForwardingPathSincePathDoesNotExist() {
         Service service = initForwardPath();
         Either<Service, ResponseFormat> serviceResponseFormatEither = bl.updateForwardingPath(FORWARDING_PATH_ID, service, user, true);
-        assertEquals(true, serviceResponseFormatEither.isRight());
+        assertTrue(serviceResponseFormatEither.isRight());
     }
 
     @Test
     public void shouldFailToDeleteForwardingPathSincePathDoesNotExist() {
         Service service = initForwardPath();
         Either<Set<String>, ResponseFormat> serviceResponseFormatEither = bl.deleteForwardingPaths("delete_forward_test", Sets.newHashSet(FORWARDING_PATH_ID), user, true);
-        assertEquals(true, serviceResponseFormatEither.isRight());
+        assertTrue(serviceResponseFormatEither.isRight());
     }
 
     @Test
@@ -51,7 +63,7 @@ public class ForwardingPathBussinessLogicTest extends BaseForwardingPathTest {
         Service service = initForwardPath();
         assertNotNull(service);
         Either<Service, ResponseFormat> serviceResponseFormatEither = bl.createForwardingPath(createdService.getUniqueId(), service, user, true);
-        assertEquals(true, serviceResponseFormatEither.isLeft());
+        assertTrue(serviceResponseFormatEither.isLeft());
         Map<String, ForwardingPathDataDefinition> forwardingPathsMap = serviceResponseFormatEither.left().value().getForwardingPaths();
         Set<String> pathIds = forwardingPathsMap.keySet();
         assertEquals(1, pathIds.size());
@@ -59,10 +71,10 @@ public class ForwardingPathBussinessLogicTest extends BaseForwardingPathTest {
 
         // should return the created path
         Either<UiComponentDataTransfer, ResponseFormat> uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
-        assertEquals(true, uiResaponse.isLeft());
+        assertTrue(uiResaponse.isLeft());
         UiServiceDataTransfer uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
         Map<String, ForwardingPathDataDefinition> forwardingPaths = uiServiceDataTransfer.getForwardingPaths();
-        assertTrue(forwardingPaths.keySet().equals(pathIds));
+        assertEquals(forwardingPaths.keySet(), pathIds);
         Map<String, ForwardingPathDataDefinition> updatedForwardingPaths = new HashMap<>(forwardingPaths);
         String newProtocol = "https";
         ForwardingPathDataDefinition forwardingPathDataDefinition = updatedForwardingPaths.values().stream().findAny().get();
@@ -81,7 +93,7 @@ public class ForwardingPathBussinessLogicTest extends BaseForwardingPathTest {
 
         // make sure changes were applied
         uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
-        assertEquals(true, uiResaponse.isLeft());
+        assertTrue(uiResaponse.isLeft());
         uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
         Map<String, ForwardingPathDataDefinition> forwardingPathsUpdated = uiServiceDataTransfer.getForwardingPaths();
         ForwardingPathDataDefinition updatedData = forwardingPathsUpdated.values().iterator().next();
@@ -91,11 +103,11 @@ public class ForwardingPathBussinessLogicTest extends BaseForwardingPathTest {
         Service createdData = serviceResponseFormatEither.left().value();
         Set<String> paths = createdData.getForwardingPaths().keySet();
         Either<Set<String>, ResponseFormat> setResponseFormatEither = bl.deleteForwardingPaths(createdService.getUniqueId(), paths, user, true);
-        assertEquals(true, setResponseFormatEither.isLeft());
+        assertTrue(setResponseFormatEither.isLeft());
 
         // nothing to return now
         uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.COMPONENT_INSTANCES.getValue(),ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
-        assertEquals(true, uiResaponse.isLeft());
+        assertTrue(uiResaponse.isLeft());
         uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
         forwardingPaths = uiServiceDataTransfer.getForwardingPaths();
         assertTrue(forwardingPaths == null || forwardingPaths.isEmpty());