@@ -0,0 +1,2750 @@
+/*%0A * JBoss, Home of Professional Open Source%0A * Copyright 2015 Red Hat, Inc., and individual contributors%0A * as indicated by the @author tags.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.wildfly.security.password.impl;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.wildfly.security.password.interfaces.ClearPassword.ALGORITHM_CLEAR;%0A%0Aimport java.security.Provider;%0Aimport java.security.Security;%0A%0Aimport org.junit.AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.wildfly.security.WildFlyElytronProvider;%0Aimport org.wildfly.security.password.PasswordFactory;%0Aimport org.wildfly.security.password.interfaces.ClearPassword;%0Aimport org.wildfly.security.password.spec.ClearPasswordSpec;%0A%0A/**%0A * Tests for the %7B@link ClearPassword%7D implementation.%0A *%0A * @author %3Ca href=%22mailto:fjuma@redhat.com%22%3EFarah Juma%3C/a%3E%0A */%0Apublic class ClearPasswordTest %7B%0A%0A    private static final Provider provider = new WildFlyElytronProvider();%0A%0A    @BeforeClass%0A    public static void registerProvider() %7B%0A        Security.addProvider(provider);%0A    %7D%0A%0A    @AfterClass%0A    public static void removeProvider() %7B%0A        Security.removeProvider(provider.getName());%0A    %7D%0A%0A    @Test%0A    public void testEmptyPassword() throws Exception %7B%0A        performTest(%22%22);%0A    %7D%0A%0A    @Test%0A    public void testNonEmptyPassword() throws Exception %7B%0A        performTest(%22p4ssw0rd!%22);%0A    %7D%0A%0A    private void performTest(final String correctPassword) throws Exception %7B%0A        PasswordFactory factory = PasswordFactory.getInstance(ALGORITHM_CLEAR);%0A        ClearPasswordSpec spec = new ClearPasswordSpec(correctPassword.toCharArray());%0A%0A        ClearPassword password = (ClearPassword) factory.generatePassword(spec);%0A        assertTrue(%22Password validation%22, factory.verify(password, correctPassword.toCharArray()));%0A        assertFalse(%22Bad password rejection%22, factory.verify(password, %22badpassword%22.toCharArray()));%0A%0A        assertTrue(%22Convertible to key spec%22, factory.convertibleToKeySpec(password, ClearPasswordSpec.class));%0A        ClearPasswordSpec clearSpec = factory.getKeySpec(password, ClearPasswordSpec.class);%0A        assertArrayEquals(correctPassword.toCharArray(), clearSpec.getEncodedPassword());%0A    %7D%0A%7D%0A

Add a ClearPassword test