2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (C) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 package org.onap.policy.admin;
24 import static org.junit.Assert.assertTrue;
25 import static org.junit.Assert.fail;
26 import static org.mockito.Mockito.mock;
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpSession;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.mockito.Mockito;
32 import org.onap.portalsdk.core.domain.User;
33 import org.onap.portalsdk.core.util.SystemProperties;
34 import org.springframework.mock.web.MockHttpServletResponse;
36 public class PolicyUserInfoControllerTest {
38 private HttpServletRequest request;
39 private MockHttpServletResponse response;
42 public void setUp() throws Exception {
43 HttpSession mockSession = mock(HttpSession.class);
44 request = mock(HttpServletRequest.class);
45 response = new MockHttpServletResponse();
46 User user = new User();
47 user.setOrgUserId("Test");
48 Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name")))
50 Mockito.when(request.getSession(false)).thenReturn(mockSession);
54 public final void testGetPolicyUserInfo() {
55 PolicyUserInfoController controller = new PolicyUserInfoController();
56 controller.getPolicyUserInfo(request, response);
58 assertTrue(response.getStatus() == 200);
59 } catch (Exception e) {