UserAttributesEditor implements IsWidget,
                                             org.uberfire.ext.security.management.client.editor.user.UserAttributesEditor { @Override public Map<String, String> getValue() { final Map<String, String> result = new HashMap<String, String>(attributes.size()); for (Map.Entry<UserManager.UserAttribute, String> entry : attributes.entrySet()) { result.put(entry.getKey().getName(), entry.getValue()); } return result; } @Inject  UserAttributesEditor(final ClientUserSystemManager userSystemManager,
                                final ConfirmBox confirmBox,
                                final Event<CreateUserAttributeEvent> createUserAttributeEventEvent,
                                final Event<UpdateUserAttributeEvent> updateUserAttributeEventEvent,
                                final Event<DeleteUserAttributeEvent> deleteUserAttributeEventEvent,
                                final Event<OnErrorEvent> errorEvent,
                                final NewUserAttributeEditor newUserAttributeEditor,
                                final View view); @PostConstruct void init(); @Override void show(final User user); @Override void edit(final User user); @Override void flush(); @Override Map<String, String> getValue(); @Override void setViolations(Set<ConstraintViolation<User>> constraintViolations); void clear(); @Override Widget asWidget(); public View view; }
@Test public void testGetValue() { UserManager.UserAttribute attribute1 = mock(UserManager.UserAttribute.class); when(attribute1.getName()).thenReturn("attr1"); when(attribute1.getDefaultValue()).thenReturn("v1"); when(attribute1.isEditable()).thenReturn(true); when(attribute1.isMandatory()).thenReturn(true); UserManager.UserAttribute attribute2 = mock(UserManager.UserAttribute.class); when(attribute2.getName()).thenReturn("attr2"); when(attribute2.getDefaultValue()).thenReturn("v2"); when(attribute2.isEditable()).thenReturn(true); when(attribute2.isMandatory()).thenReturn(true); Map<UserManager.UserAttribute, String> attrs = new HashMap<UserManager.UserAttribute, String>(1); attrs.put(attribute1, "value1"); attrs.put(attribute2, "value2"); presenter.attributes = attrs; Map<String, String> result = presenter.getValue(); assertNotNull(result); assertTrue(result.size() == 2); assertEquals("value1", result.get("attr1")); assertEquals("value2", result.get("attr2")); }