@@ -0,0 +1,3198 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage edu.harvard.iq.dataverse.authorization;%0A%0Aimport edu.harvard.iq.dataverse.util.BundleUtil;%0Aimport java.util.AbstractMap.SimpleEntry;%0Aimport java.util.Collections;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.Stream;%0Aimport org.junit.After;%0Aimport org.junit.AfterClass;%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0A%0A/**%0A *%0A * @author rmp553%0A */%0Apublic class AuthenticationProviderTest %7B%0A    %0A    public AuthenticationProviderTest() %7B%0A    %7D%0A    %0A    @BeforeClass%0A    public static void setUpClass() %7B%0A    %7D%0A    %0A    @AfterClass%0A    public static void tearDownClass() %7B%0A    %7D%0A    %0A    @Before%0A    public void setUp() %7B%0A    %7D%0A    %0A    @After%0A    public void tearDown() %7B%0A    %7D%0A%0A    /**%0A     * Create a map used to test known AuthenticationProvider ids%0A     * %0A     * @return %0A     */%0A    private Map%3CString, String%3E getBundleTestMap()%7B%0A        return Collections.unmodifiableMap(Stream.of(%0A                new SimpleEntry%3C%3E(%22builtin%22, %22authenticationProvider.name.builtin%22),%0A                new SimpleEntry%3C%3E(%22github%22, %22authenticationProvider.name.github%22),%0A                new SimpleEntry%3C%3E(%22google%22, %22authenticationProvider.name.google%22),%0A                new SimpleEntry%3C%3E(%22orcid%22, %22authenticationProvider.name.orcid%22),%0A                new SimpleEntry%3C%3E(%22orcid-sandbox%22, %22authenticationProvider.name.orcid-sandbox%22),%0A                new SimpleEntry%3C%3E(%22shib%22, %22authenticationProvider.name.shib%22))%0A                .collect(Collectors.toMap((e) -%3E e.getKey(), (e) -%3E e.getValue())));%0A    %7D%0A    %0A    /**%0A     * Test of getFriendlyName method, of class AuthenticationProvider.%0A     */%0A    @Test%0A    public void testGetFriendlyName() %7B%0A        System.out.println(%22getFriendlyName%22);%0A        %0A        Map%3CString, String%3E bundleTestMap = this.getBundleTestMap();%0A        %0A        // ------------------------------------------%0A        // Test a null%0A        // ------------------------------------------%0A        String expResult = BundleUtil.getStringFromBundle(%22authenticationProvider.name.null%22);%0A        assertEquals(expResult, AuthenticationProvider.getFriendlyName(null));%0A        %0A        // ------------------------------------------%0A        // Test an id w/o a bundle entry--should default to id%0A        // ------------------------------------------%0A        String idNotInBundle = %22id-not-in-bundle-so-use-id%22;%0A        String expResult2 = AuthenticationProvider.getFriendlyName(idNotInBundle);%0A        assertEquals(expResult2, idNotInBundle);%0A        %0A        // ------------------------------------------%0A        // Iterate through the map and test each item%0A        // ------------------------------------------%0A        bundleTestMap.forEach((authProviderId, bundleName)-%3E%7B%0A            String expectedResult = BundleUtil.getStringFromBundle(bundleName);%0A            assertEquals(expectedResult, AuthenticationProvider.getFriendlyName(authProviderId));%0A        %7D);    %0A                   %0A    %7D%0A%0A%0A    %0A%7D%0A

add test for AuthenticationProvider bundle names #3614