summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/test/java/org')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java68
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java25
2 files changed, 1 insertions, 92 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java
index fc0871a9..e3158bf2 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java
@@ -108,73 +108,7 @@ public class ProfileControllerTest {
@Mock
UserUtils userUtils = new UserUtils();
- @Test
- public void profileTest() throws IOException {
- ModelAndView actualModelAndView = new ModelAndView("profile");
- User user = new User();
- user.setOrgUserId("test");
- Long profileId = null;
- PowerMockito.mockStatic(AppUtils.class);
- PowerMockito.mockStatic(UserUtils.class);
- Mockito.when(mockedRequest.getRequestURI()).thenReturn("self_profile.htm");
- Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("test");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD"))
- .thenReturn(new ArrayList<>());
- Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
- ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
- assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
- }
-
- @Test
- public void profileRequestURITest() throws IOException {
- ModelAndView actualModelAndView = new ModelAndView("profile");
- User user = new User();
- user.setOrgUserId("test");
- int profileId = 1;
- PowerMockito.mockStatic(AppUtils.class);
- PowerMockito.mockStatic(UserUtils.class);
- Mockito.when(mockedRequest.getRequestURI()).thenReturn("test");
- Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("1");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
- Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD"))
- .thenReturn(new ArrayList<>());
- Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
- ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
- assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
- }
-
- @Test
- public void profileExceptionTest() throws IOException {
- ModelAndView actualModelAndView = new ModelAndView("profile");
- User profile = null;
- Long profileId = null;
- Mockito.when(mockedRequest.getRequestURI()).thenReturn("self_profile.htm");
- Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("test");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(profile);
- ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
- assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
- }
-
- @Test
- public void selfProfileTest() throws Exception {
- ModelAndView actualModelAndView = new ModelAndView("profile");
- PowerMockito.mockStatic(AppUtils.class);
- PowerMockito.mockStatic(UserUtils.class);
- Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD"))
- .thenReturn(new ArrayList<>());
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- ModelAndView expectedModelAndView = profileController.selfProfile(mockedRequest);
- assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
- }
-
- @Test
- public void selfProfileExceptionTest() throws Exception {
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- profileController.selfProfile(mockedRequest);
- }
+
@SuppressWarnings("rawtypes")
@Test
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java
index cc672156..185672ff 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java
@@ -119,31 +119,6 @@ public class ProfileSearchControllerTest {
profileSearchController.profileSearch(mockedRequest);
}
- @Test
- public void getUserTest() throws IOException, PortalAPIException{
- List<User> profileList = new ArrayList<>();
- User user = new User();
- user.setOrgUserId("test");
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(loginStrategy.getUserId(mockedRequest)).thenReturn("test");
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- Mockito.when(service.findAll()).thenReturn(profileList);
- profileSearchController.getUser(mockedRequest, mockedResponse);
- }
-
- @Test
- public void getUserExceptionTest() throws IOException, PortalAPIException{
- List<User> profileList = null;
- User user = new User();
- user.setOrgUserId("test");
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(loginStrategy.getUserId(mockedRequest)).thenReturn("test");
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- Mockito.when(service.findAll()).thenReturn(profileList);
- profileSearchController.getUser(mockedRequest, mockedResponse);
- }
@Test
public void getUserPaginationTest() throws IOException{