AMPropertySheetTest.java revision 921c9e8e47accb592cc0dcda4f6973aabc1935ce
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Copyright 2014 ForgeRock, AS.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * The contents of this file are subject to the terms of the Common Development and
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Distribution License (the License). You may not use this file except in compliance with the
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * specific language governing permission and limitations under the License.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * When distributing Covered Software, include this CDDL Header Notice in each file and include
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Header, with the fields enclosed by brackets [] replaced by your own identifying
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * information: "Portions copyright [year] [name of copyright owner]".
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Maddenimport com.iplanet.jato.model.ModelControlException;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Maddenimport com.sun.identity.console.base.model.AMConsoleException;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Maddenimport com.sun.identity.console.base.model.AMModel;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Maddenimport com.sun.identity.console.base.model.AMPropertySheetModel;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Maddenimport static org.fest.assertions.Assertions.assertThat;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Basic unit tests for {@link AMPropertySheet}.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * @since 12.0.0
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden public void setupMocks() {
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden propertySheet = new AMPropertySheet(mockContainerView, mockModel, NAME);
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * OPENAM-3579: Test that the property sheet completely removes any properties that are set to the empty string.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * This ensures that optional attributes can be removed by blanking out the associated field.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden public void shouldRemoveEmptyStringPropertyValues() throws ModelControlException, AMConsoleException {
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden Map<String, Set<String>> oldValues = Collections.singletonMap(key, Collections.singleton(oldValue));
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden given(mockModel.isChildSupported(key)).willReturn(true);
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden given(mockModel.getValues(key)).willReturn(new Object[] { newValue });
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden Map<String, Set<String>> result = propertySheet.getAttributeValues(oldValues, true, amModel);