@@ -1021,10 +1021,13 @@ public void testValidateRoleChangeUnknownNewRole() {
10211021 accountManagerImpl .validateRoleChange (account , newRole , caller );
10221022 }
10231023
1024- @ Test ( expected = PermissionDeniedException . class )
1025- public void testValidateRoleNewRoleSame () {
1024+ @ Test
1025+ public void testValidateRoleNewRoleSameCaller () {
10261026 Account account = Mockito .mock (Account .class );
10271027 Mockito .when (account .getRoleId ()).thenReturn (1L );
1028+ Role currentRole = Mockito .mock (Role .class );
1029+ Mockito .when (currentRole .getRoleType ()).thenReturn (RoleType .User );
1030+ Mockito .when (roleService .findRole (1L )).thenReturn (currentRole );
10281031 Role newRole = Mockito .mock (Role .class );
10291032 Mockito .when (newRole .getRoleType ()).thenReturn (RoleType .DomainAdmin );
10301033 Role callerRole = Mockito .mock (Role .class );
@@ -1035,8 +1038,8 @@ public void testValidateRoleNewRoleSame() {
10351038 accountManagerImpl .validateRoleChange (account , newRole , caller );
10361039 }
10371040
1038- @ Test ( expected = PermissionDeniedException . class )
1039- public void testValidateRoleCurrentRoleSame () {
1041+ @ Test
1042+ public void testValidateRoleCurrentRoleSameCaller () {
10401043 Account account = Mockito .mock (Account .class );
10411044 Mockito .when (account .getRoleId ()).thenReturn (1L );
10421045 Role accountRole = Mockito .mock (Role .class );
@@ -1053,7 +1056,7 @@ public void testValidateRoleCurrentRoleSame() {
10531056 }
10541057
10551058 @ Test (expected = PermissionDeniedException .class )
1056- public void testValidateRoleNewRoleHigher () {
1059+ public void testValidateRoleNewRoleHigherCaller () {
10571060 Account account = Mockito .mock (Account .class );
10581061 Mockito .when (account .getRoleId ()).thenReturn (1L );
10591062 Role newRole = Mockito .mock (Role .class );
@@ -1067,7 +1070,7 @@ public void testValidateRoleNewRoleHigher() {
10671070 }
10681071
10691072 @ Test
1070- public void testValidateRoleNewRoleLower () {
1073+ public void testValidateRoleNewRoleLowerCaller () {
10711074 Account account = Mockito .mock (Account .class );
10721075 Mockito .when (account .getRoleId ()).thenReturn (1L );
10731076 Role newRole = Mockito .mock (Role .class );
0 commit comments