nitin-maharana commented on a change in pull request #2606: When creating a new 
account (via domain admin) it is possible to select “root admin” as the role 
for the new user
URL: https://github.com/apache/cloudstack/pull/2606#discussion_r184453195
 
 

 ##########
 File path: 
server/src/test/java/org/apache/cloudstack/acl/RoleManagerImplTest.java
 ##########
 @@ -0,0 +1,288 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+package org.apache.cloudstack.acl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.acl.dao.RoleDao;
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RoleManagerImplTest {
+
+    @Spy
+    @InjectMocks
+    private RoleManagerImpl roleManagerImpl;
+    @Mock
+    private AccountManager accountManagerMock;
+    @Mock
+    private RoleDao roleDaoMock;
+
+    @Mock
+    private Account accountMock;
+    private long accountMockId = 100l;
+
+    @Mock
+    private RoleVO roleVoMock;
+    private long roleMockId = 1l;
+
+    @Before
+    public void beforeTest() {
+        Mockito.doReturn(accountMockId).when(accountMock).getId();
+        
Mockito.doReturn(accountMock).when(roleManagerImpl).getCurrentAccount();
+
+        Mockito.doReturn(roleMockId).when(roleVoMock).getId();
+    }
+
+    @Test
+    public void findRoleTestIdNull() {
+        Role returedRole = roleManagerImpl.findRole(null);
 
 Review comment:
   TYPO. I think you mean to be returnedRole( r -> n ). Next seven tests from 
here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to