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 static org.fest.assertions.Assertions.assertThat;
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Basic unit tests for {@link AMAdminUtils#toSet(Object...)} and {@link AMAdminUtils#toSetIgnoreEmpty(Object...)}.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * Note: tests characterise the existing behaviour to avoid accidentally breaking anything, rather than specifying what
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * the behaviour should be.
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden * @since 12.0.0
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden public void shouldReturnEmptySetForNullArray() {
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden @Test(expectedExceptions = NullPointerException.class)
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden // Then - exception
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden public void shouldPreserveEmptyStringsNormally() {
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden assertEquals(result, new HashSet<String>(Arrays.asList(args)));
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden Set<String> result = AMAdminUtils.toSetIgnoreEmpty(args);
921c9e8e47accb592cc0dcda4f6973aabc1935ceNeil Madden assertEquals(result, new HashSet<String>(Arrays.asList("foo", "bar")));