UserAssignedRolesExplorer extends UserAssignedEntitiesExplorer<Role> implements org.uberfire.ext.security.management.client.editor.user.UserAssignedRolesExplorer { @Override protected void removeEntity(String name) { Iterator<Role> roles = this.entities.iterator(); while (roles.hasNext()) { final Role g = roles.next(); if (g.getName().equals(name)) { roles.remove(); } } doShow(); removeUserRoleEvent.fire(new OnRemoveUserRoleEvent(UserAssignedRolesExplorer.this, name)); } @Inject  UserAssignedRolesExplorer(final ClientUserSystemManager userSystemManager,
                                     final ConfirmBox confirmBox,
                                     final RolesList rolesList,
                                     final AssignedEntitiesExplorer view,
                                     final Event<OnRemoveUserRoleEvent> removeUserRoleEvent);   }
@Test public void testRemoveRole() { Role r = mock(Role.class); when(r.getName()).thenReturn("role1"); tested.entities.add(r); tested.removeEntity("role1"); assertFalse(tested.isEditMode); assertTrue(tested.entities.size() == 0); verify(rolesList, times(1)).show(anySet(), any(EntitiesList.Callback.class)); verify(removeUserRoleEventEvent, times(1)).fire(any(OnRemoveUserRoleEvent.class)); verify(view, times(0)).configure(anyString(), any(EntitiesList.View.class)); verify(view, times(0)).clear(); verify(rolesList, times(0)).clear(); }