* See the License for the specific language governing permissions and\r
* limitations under the License.\r
* ============LICENSE_END============================================\r
+ * Modifications copyright (c) 2018 Nokia\r
* ===================================================================\r
* \r
*/\r
*/\r
public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(\r
List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {\r
- List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;\r
+ List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = new ArrayList<>();\r
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {\r
// sort list\r
Collections.sort(rawCldsSdcResourceListBasicList);\r
// and then take only the resources with the max version (last in\r
// the list with the same name)\r
- cldsSdcResourceBasicInfoList = new ArrayList<>();\r
for (int i = 1; i < rawCldsSdcResourceListBasicList.size(); i++) {\r
// compare name with previous - if not equal, then keep the\r
// previous (it's the last with that name)\r
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
+ * Modifications copyright (c) 2018 Nokia
* ===================================================================
*
*/
package org.onap.clamp.clds.it;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
assertTrue("1.0".equals(res2.getVersion()));
}
+
+ @Test
+ public void removeDuplicateSdcFunctionShouldNotReturnNull(){
+ // given
+ SdcCatalogServices catalogServices = new SdcCatalogServices();
+
+ // when
+ List<SdcResourceBasicInfo> firstResult = catalogServices
+ .removeDuplicateSdcResourceBasicInfo(null);
+ List<SdcResourceBasicInfo> secondResult = catalogServices
+ .removeDuplicateSdcResourceBasicInfo(new ArrayList<>());
+
+ // then
+ assertThat(firstResult).isEmpty();
+ assertThat(secondResult).isEmpty();
+ }
+
@Test
public void getServiceUuidFromServiceInvariantIdTest() throws Exception {
SdcCatalogServices spy = Mockito.spy(sdcCatalogWired);