X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-os%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Fservice%2FSearchServiceImplTest.java;h=04234059e1c4a0349a19500cdb25570e8353430a;hb=a59bc3e85eaf33c0a38063e5c30fe890588a0eb1;hp=339f4ebb73e9cf718247fa2f3a428d07baeaed7f;hpb=21a8761f684745bb300e075c7e98ad897ace9eed;p=portal.git diff --git a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java index 339f4ebb..04234059 100644 --- a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -33,11 +33,12 @@ * * ============LICENSE_END============================================ * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ package org.onap.portalapp.portal.service; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.util.ArrayList; import java.util.List; @@ -55,8 +56,6 @@ import org.mockito.MockitoAnnotations; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.framework.MockEPUser; import org.onap.portalapp.portal.framework.MockitoTestSuite; -import org.onap.portalapp.portal.service.SearchServiceImpl; -import org.onap.portalapp.portal.service.UserService; import org.onap.portalapp.portal.transport.UserWithNameSurnameTitle; import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.powermock.api.mockito.PowerMockito; @@ -105,19 +104,18 @@ public class SearchServiceImplTest { PowerMockito.mockStatic(EcompPortalUtils.class); List list = new ArrayList<>(); String str = "Test"; - String str2 = "Test new"; - String str1 = "Test new1"; + String str1 = "Testnew"; list.add(str); list.add(str1); - list.add(str2); - Mockito.when(EcompPortalUtils.parsingByRegularExpression("Test", " ")).thenReturn(list); + Mockito.when(EcompPortalUtils.parsingByRegularExpression("Test Testnew", " ")).thenReturn(list); + @SuppressWarnings({ "unchecked", "rawtypes" }) List userList = new ArrayList(); EPUser user = mockUser.mockEPUser(); - user.setLastName("Test new"); + user.setLastName("Testnew"); userList.add(user); - Mockito.when( this.userService.getUserByFirstLastName("Test","Test new")).thenReturn(userList); - String result = searchServiceImpl.searchUsersInPhoneBook("Test"); - assertEquals("[{\"orgUserId\":\"guestT\",\"firstName\":\"test\",\"lastName\":\"Test new\",\"jobTitle\":null}]" , result); + Mockito.when( this.userService.getUserByFirstLastName("Test","Testnew")).thenReturn(userList); + String result = searchServiceImpl.searchUsersInPhoneBook("Test Testnew"); + assertEquals("[{\"orgUserId\":\"guestT\",\"firstName\":\"test\",\"lastName\":\"Testnew\",\"jobTitle\":null}]" , result); }