/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.crypto.signer.internal.factory;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.xwiki.crypto.internal.asymmetric.keyfactory.BcRSAKeyFactory;
import org.xwiki.crypto.internal.digest.factory.BcSHA1DigestFactory;
import org.xwiki.crypto.internal.digest.factory.BcSHA224DigestFactory;
import org.xwiki.crypto.internal.digest.factory.BcSHA256DigestFactory;
import org.xwiki.crypto.internal.digest.factory.BcSHA384DigestFactory;
import org.xwiki.crypto.internal.digest.factory.BcSHA512DigestFactory;
import org.xwiki.crypto.internal.encoder.Base64BinaryStringEncoder;
import org.xwiki.crypto.signer.Signer;
import org.xwiki.crypto.signer.SignerFactory;
import org.xwiki.test.annotation.ComponentList;
import org.xwiki.test.mockito.MockitoComponentMockingRule;

/**
 * Please comment here
 *
 * @version $Id$
 */
@ComponentList({Base64BinaryStringEncoder.class, BcRSAKeyFactory.class, BcSHA1DigestFactory.class,
    BcSHA224DigestFactory.class, BcSHA256DigestFactory.class, BcSHA384DigestFactory.class,
    BcSHA512DigestFactory.class, BcSHA1withRsaSignerFactory.class, BcSHA224withRsaSignerFactory.class,
    BcSHA256withRsaSignerFactory.class, BcSHA384withRsaSignerFactory.class, BcSHA512withRsaSignerFactory.class,
    BcRsaSsaPssSignerFactory.class, BcMD5withRsaSignerFactory.class})
public class DefaultSignerFactoryTest extends AbstractRsaSignerFactoryTest
{
    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mocker =
        new MockitoComponentMockingRule<SignerFactory>(DefaultSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerPss =
        new MockitoComponentMockingRule<SignerFactory>(BcRsaSsaPssSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerSha1 =
        new MockitoComponentMockingRule<SignerFactory>(BcSHA1withRsaSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerSha224 =
        new MockitoComponentMockingRule<SignerFactory>(BcSHA224withRsaSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerSha256 =
        new MockitoComponentMockingRule<SignerFactory>(BcSHA256withRsaSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerSha384 =
        new MockitoComponentMockingRule<SignerFactory>(BcSHA384withRsaSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerSha512 =
        new MockitoComponentMockingRule<SignerFactory>(BcSHA512withRsaSignerFactory.class);

    @Rule
    public final MockitoComponentMockingRule<SignerFactory> mockerMD5 =
        new MockitoComponentMockingRule<SignerFactory>(BcMD5withRsaSignerFactory.class);

    private SignerFactory factory;

    @Before
    public void configure() throws Exception
    {
        factory = mocker.getComponentUnderTest();
        setupTest(mocker);
    }

    private void test(MockitoComponentMockingRule<SignerFactory> mocker) throws Exception
    {
        Signer signer = mocker.getComponentUnderTest().getInstance(true, privateKey);
        testSignatureVerification(
            signer,
            factory.getInstance(false, publicKey, signer.getEncoded())
        );
    }

    @Test
    public void testPssSignatureVerification() throws Exception
    {
        test(mockerPss);
    }

    @Test
    public void testSha1SignatureVerification() throws Exception
    {
        test(mockerSha1);
    }

    @Test
    public void testSha224SignatureVerification() throws Exception
    {
        test(mockerSha224);
    }

    @Test
    public void testSha256SignatureVerification() throws Exception
    {
        test(mockerSha256);
    }

    @Test
    public void testSha384SignatureVerification() throws Exception
    {
        test(mockerSha384);
    }

    @Test
    public void testSha512SignatureVerification() throws Exception
    {
        test(mockerSha512);
    }

    @Test
    public void testMd5SignatureVerification() throws Exception
    {
        test(mockerMD5);
    }
}

@@ -1706,27 +1706,52 @@
 %0A * 
-Please comment here
+Unit tests for %7B@link DefaultSignerFactory%7D.
 %0A *%0A
@@ -3916,17 +3916,20 @@
 te void 
-t
+runT
 est(Mock
@@ -4308,33 +4308,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerPss);%0A
@@ -4424,33 +4424,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerSha1);
@@ -4543,33 +4543,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerSha224
@@ -4664,33 +4664,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerSha256
@@ -4785,33 +4785,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerSha384
@@ -4906,33 +4906,36 @@
 n%0A    %7B%0A        
-t
+runT
 est(mockerSha512
@@ -5032,17 +5032,20 @@
         
-t
+runT
 est(mock

Add missing javadoc + fix method name that triggers error in quality checks (confused with a test method).