JAMES-1738 Reformat Onami Test imported code

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/7adbc83c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/7adbc83c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/7adbc83c

Branch: refs/heads/master
Commit: 7adbc83c15090d64fe22c03f5170aaeb2321beea
Parents: a37176f
Author: Benoit Tellier <[email protected]>
Authored: Wed Oct 5 14:32:15 2016 +0200
Committer: Benoit Tellier <[email protected]>
Committed: Wed Oct 5 14:57:39 2016 +0200

----------------------------------------------------------------------
 .../james/mpt/onami/test/GuiceMockModule.java   | 108 +++---
 .../james/mpt/onami/test/MockEngineFactory.java |  18 +-
 .../james/mpt/onami/test/OnamiRunner.java       | 363 ++++++++-----------
 .../apache/james/mpt/onami/test/OnamiSuite.java | 314 +++++++---------
 .../mpt/onami/test/annotation/GuiceModules.java |   7 +-
 .../test/annotation/GuiceProvidedModules.java   |   7 +-
 .../james/mpt/onami/test/annotation/Mock.java   |  10 +-
 .../onami/test/annotation/MockFramework.java    |   7 +-
 .../mpt/onami/test/annotation/MockObjType.java  |  17 +-
 .../mpt/onami/test/annotation/MockType.java     |   7 +-
 .../onami/test/guice/MockMembersInjector.java   |  37 +-
 .../mpt/onami/test/guice/MockTypeListener.java  |  35 +-
 .../handler/GuiceInjectableClassHandler.java    |  31 +-
 .../onami/test/handler/GuiceModuleHandler.java  |  33 +-
 .../handler/GuiceProvidedModuleHandler.java     | 100 ++---
 .../test/handler/MockFrameworkHandler.java      |  26 +-
 .../mpt/onami/test/handler/MockHandler.java     | 167 ++++-----
 .../james/mpt/onami/test/mock/MockEngine.java   |  11 +-
 .../test/mock/framework/EasyMockFramework.java  |  23 +-
 .../test/mock/framework/MockitoFramework.java   |  15 +-
 .../test/reflection/AnnotationHandler.java      |   9 +-
 .../mpt/onami/test/reflection/ClassHandler.java |   4 +-
 .../mpt/onami/test/reflection/ClassVisitor.java |  63 ++--
 .../mpt/onami/test/reflection/FieldHandler.java |   4 +-
 .../onami/test/reflection/HandleException.java  |  25 +-
 .../onami/test/reflection/MethodHandler.java    |   4 +-
 .../mpt/onami/test/AbstractEmptyTestCase.java   |  12 +-
 .../mpt/onami/test/AbstractMockTestCase.java    |  11 +-
 .../mpt/onami/test/AbstractMockitoTestCase.java |  13 +-
 .../james/mpt/onami/test/AbstractTestCase.java  |  45 +--
 .../test/InjectDependingMockObjectTestCase.java |  43 +--
 .../test/InjectFromSuperClassTestCase.java      |  28 +-
 .../test/InjectJSR330ModuleClassTestCase.java   |  20 +-
 .../onami/test/InjectMockObjectTestCase.java    |  63 ++--
 .../onami/test/InjectModuleClassTestCase.java   |  23 +-
 .../onami/test/InjectStaticSimpleTestCase.java  |  29 +-
 .../james/mpt/onami/test/MockTypeTestCase.java  |  12 +-
 .../onami/test/MockitoFrameworkTestCase.java    |  24 +-
 .../james/mpt/onami/test/OnamiSuiteTest.java    |   2 +-
 .../mpt/onami/test/ServiceMockProviderTest.java |  12 +-
 .../apache/james/mpt/onami/test/SimpleTest.java |  21 +-
 .../mpt/onami/test/data/ComplexModule.java      |  12 +-
 .../mpt/onami/test/data/HelloWordAnnotated.java |  12 +-
 .../james/mpt/onami/test/data/HelloWorld.java   |  30 +-
 .../james/mpt/onami/test/data/Service.java      |   5 +-
 .../james/mpt/onami/test/data/ServiceImpl.java  |  10 +-
 .../onami/test/data/ServiceMockProvider.java    |   8 +-
 .../mpt/onami/test/data/ServiceModule.java      |  11 +-
 .../james/mpt/onami/test/data/SimpleModule.java |   9 +-
 .../mpt/onami/test/data/TelephonService.java    |   3 +-
 .../onami/test/data/TelephonServiceImpl.java    |   6 +-
 .../mpt/onami/test/data/TestAnnotation.java     |   5 +-
 .../mpt/onami/test/data/TestAnnotation2.java    |   5 +-
 .../apache/james/mpt/onami/test/data/WhoIm.java |   9 +-
 .../test/guice/MockAnnotatedWithTestCase.java   |  43 +--
 .../test/guice/TestCustomInjectionTest.java     |  42 +--
 56 files changed, 827 insertions(+), 1186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
index 645e57f..a0ab7ae 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
@@ -57,11 +57,9 @@ import com.google.inject.name.Names;
  * into the test class.
  * </p>
  */
-public class GuiceMockModule
-    extends AbstractModule
-{
+public class GuiceMockModule extends AbstractModule {
 
-    private static final Logger LOGGER = Logger.getLogger( 
GuiceMockModule.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(GuiceMockModule.class.getName());
 
     final Map<Field, Object> mockedFields;
 
@@ -71,54 +69,42 @@ public class GuiceMockModule
      * @param mockedFields the map of mock fileds.
      */
 
-    public GuiceMockModule( final Map<Field, Object> mockedFields )
-    {
+    public GuiceMockModule(final Map<Field, Object> mockedFields) {
         this.mockedFields = mockedFields;
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     @Override
-    protected void configure()
-    {
+    protected void configure() {
         final Multimap<Type, Field> fieldsByType = HashMultimap.create();
 
-        for ( final Entry<Field, Object> entry : this.mockedFields.entrySet() )
-        {
-            fieldsByType.put( entry.getKey().getGenericType(), entry.getKey() 
);
+        for (final Entry<Field, Object> entry : this.mockedFields.entrySet()) {
+            fieldsByType.put(entry.getKey().getGenericType(), entry.getKey());
         }
 
-        for ( final Type type : fieldsByType.keySet() )
-        {
-            final Collection<Field> fields = fieldsByType.get( type );
+        for (final Type type : fieldsByType.keySet()) {
+            final Collection<Field> fields = fieldsByType.get(type);
 
             boolean isTypeConflicts = false;
-            if ( fields.size() != 1 )
-            {
-                isTypeConflicts = checkTypeConflict( fields );
+            if (fields.size() != 1) {
+                isTypeConflicts = checkTypeConflict(fields);
             }
 
-            checkState( !isTypeConflicts, "   Found multiple annotation @%s 
for type: %s; binding skipped!.",
-                        Mock.class.getSimpleName(), type );
-            for ( final Field field : fields )
-            {
-                final TypeLiteral literal = TypeLiteral.get( type );
-                final Mock annoBy = field.getAnnotation( Mock.class );
-                final Object mock = this.mockedFields.get( field );
-                if ( annoBy.annotatedWith() != Mock.NoAnnotation.class )
-                {
-                    bind( literal ).annotatedWith( annoBy.annotatedWith() 
).toInstance( mock );
+            checkState(!isTypeConflicts, "   Found multiple annotation @%s for 
type: %s; binding skipped!.",
+                Mock.class.getSimpleName(), type);
+            for (final Field field : fields) {
+                final TypeLiteral literal = TypeLiteral.get(type);
+                final Mock annoBy = field.getAnnotation(Mock.class);
+                final Object mock = this.mockedFields.get(field);
+                if (annoBy.annotatedWith() != Mock.NoAnnotation.class) {
+                    
bind(literal).annotatedWith(annoBy.annotatedWith()).toInstance(mock);
+                } else if (!"".equals(annoBy.namedWith())) {
+                    
bind(literal).annotatedWith(Names.named(annoBy.namedWith())).toInstance(mock);
+                } else {
+                    bind(literal).toInstance(mock);
                 }
-                else if ( !"".equals( annoBy.namedWith() ) )
-                {
-                    bind( literal ).annotatedWith( Names.named( 
annoBy.namedWith() ) ).toInstance( mock );
-                }
-                else
-                {
-                    bind( literal ).toInstance( mock );
-                }
-                if ( LOGGER.isLoggable( Level.FINER ) )
-                {
-                    LOGGER.finer( "    Created binding for: " + type + " " + 
annoBy );
+                if (LOGGER.isLoggable(Level.FINER)) {
+                    LOGGER.finer("    Created binding for: " + type + " " + 
annoBy);
                 }
             }
         }
@@ -128,50 +114,38 @@ public class GuiceMockModule
      * @param fields
      * @return
      */
-    private boolean checkTypeConflict( Collection<Field> fields )
-    {
+    private boolean checkTypeConflict(Collection<Field> fields) {
         final List<Class<?>> listAnnotatedType = new ArrayList<Class<?>>();
         final List<String> listNamedType = new ArrayList<String>();
         int numOfSimpleType = 0;
 
-        for ( Field field : fields )
-        {
-            final Mock annoBy = field.getAnnotation( Mock.class );
+        for (Field field : fields) {
+            final Mock annoBy = field.getAnnotation(Mock.class);
 
-            if ( annoBy.annotatedWith() == Mock.NoAnnotation.class && 
"".equals( annoBy.namedWith() ) )
-            {
+            if (annoBy.annotatedWith() == Mock.NoAnnotation.class && 
"".equals(annoBy.namedWith())) {
                 numOfSimpleType++;
             }
-            if ( numOfSimpleType > 1 )
-            {
-                LOGGER.finer( "Found multiple simple type" );
+            if (numOfSimpleType > 1) {
+                LOGGER.finer("Found multiple simple type");
                 return true;
             }
 
-            if ( annoBy.annotatedWith() != Mock.NoAnnotation.class )
-            {
-                if ( !listAnnotatedType.contains( annoBy.annotatedWith() ) )
-                {
-                    listAnnotatedType.add( annoBy.annotatedWith() );
-                }
-                else
-                {
+            if (annoBy.annotatedWith() != Mock.NoAnnotation.class) {
+                if (!listAnnotatedType.contains(annoBy.annotatedWith())) {
+                    listAnnotatedType.add(annoBy.annotatedWith());
+                } else {
                     // found two fields with same annotation
-                    LOGGER.finer( "Found multiple annotatedBy type" );
+                    LOGGER.finer("Found multiple annotatedBy type");
                     return true;
                 }
             }
 
-            if ( !"".equals( annoBy.namedWith() ) )
-            {
-                if ( !listNamedType.contains( annoBy.namedWith() ) )
-                {
-                    listNamedType.add( annoBy.namedWith() );
-                }
-                else
-                {
+            if (!"".equals(annoBy.namedWith())) {
+                if (!listNamedType.contains(annoBy.namedWith())) {
+                    listNamedType.add(annoBy.namedWith());
+                } else {
                     // found two fields with same named annotation
-                    LOGGER.finer( "Found multiple namedWith type" );
+                    LOGGER.finer("Found multiple namedWith type");
                     return true;
                 }
             }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
index ad10daf..37d64ca 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
@@ -26,17 +26,15 @@ import 
org.apache.james.mpt.onami.test.mock.framework.MockitoFramework;
 
 /**
  * Factory class to create the mock framework.
- * 
+ *
  * @see org.apache.onami.test.annotation.MockFramework
  */
-final class MockEngineFactory
-{
+final class MockEngineFactory {
 
     /**
      * Hidden constructor, this class must not be instantiated directly.
      */
-    private MockEngineFactory()
-    {
+    private MockEngineFactory() {
         // do nothing
     }
 
@@ -44,14 +42,12 @@ final class MockEngineFactory
      * Mock factory constructor. <br>
      * Supported framewors: <li> {@link MockType}.EASY_MOCK <li> {@link 
MockType}.MOCKITO <br>
      *
-     * @see MockType
      * @param type of mock framework to create.
      * @return An instance of mock framework.
+     * @see MockType
      */
-    public static MockEngine getMockEngine(MockType type )
-    {
-        switch ( type )
-        {
+    public static MockEngine getMockEngine(MockType type) {
+        switch (type) {
             case EASY_MOCK:
                 return new EasyMockFramework();
 
@@ -59,7 +55,7 @@ final class MockEngineFactory
                 return new MockitoFramework();
 
             default:
-                throw new IllegalArgumentException( "Unrecognized MockType '" 
+ type.name() + "'" );
+                throw new IllegalArgumentException("Unrecognized MockType '" + 
type.name() + "'");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
index 3ca9f6c..78ae0a5 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
@@ -69,37 +69,34 @@ import com.google.inject.util.Modules;
  * </p>
  * <p>
  * <b>Example #1:</b> <br>
- * 
+ * <p>
  * <pre>
- * 
+ *
  * &#064;org.junit.runner.RunWith( OnamiRunner.class )
  * &#064;GuiceModules( SimpleModule.class )
  * public class AcmeTestCase
  * {
- * 
+ *
  *     &#064;GuiceProvidedModules
  *     static public Module getProperties()
  *     {
-
-import org.apache.onami.test.reflection.AnnotationHandler;
-import org.apache.onami.test.reflection.HandleException;
  *         ...
  *         return Modules.combine(new ComplexModule( loadProperies() ), ...  );
  *     }
- * 
+ *
  * </pre>
- * 
+ * <p>
  * </p>
  * <p>
  * <b>Example #2:</b> <br>
- * 
+ * <p>
  * <pre>
- * 
+ *
  * &#064;org.junit.runner.RunWith( OnamiRunner.class )
  * public class AcmeTestCase
  *     extends com.google.inject.AbstractModule
  * {
- * 
+ *
  *     public void configure()
  *     {
  *         // Configure your proper modules
@@ -107,13 +104,13 @@ import org.apache.onami.test.reflection.HandleException;
  *         bind( Service.class ).annotatedWith( TestAnnotation.class ).to( 
ServiceTestImpl.class );
  *         ...
  *     }
- * 
+ *
  *     &#064;Mock
  *     private AnotherService serviceMock;
- * 
+ *
  *     &#064;Inject
  *     private Service serviceTest;
- * 
+ *
  *     &#064;org.junit.Test
  *     public void test()
  *     {
@@ -121,92 +118,78 @@ import org.apache.onami.test.reflection.HandleException;
  *         assertNotNull( serviceTest );
  *     }
  * </pre>
- * 
+ * <p>
  * </p>
- * 
+ *
  * @see GuiceMockModule
  */
-public class OnamiRunner
-    extends BlockJUnit4ClassRunner
-{
+public class OnamiRunner extends BlockJUnit4ClassRunner {
 
-    private static final Logger LOGGER = Logger.getLogger( 
OnamiRunner.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(OnamiRunner.class.getName());
 
     private Injector injector;
 
     private final List<Module> allModules;
 
-    private final Map<Field, Object> mocked = new HashMap<Field, Object>( 1 );
+    private final Map<Field, Object> mocked = new HashMap<Field, Object>(1);
 
     private MockType mockFramework = MockType.EASY_MOCK;
 
     /**
      * OnamiRunner constructor to create the core JUnice class.
-     * 
-     * @see org.junit.runner.RunWith
+     *
      * @param klass The test case class to run.
      * @throws org.junit.runners.model.InitializationError if any error occurs.
+     * @see org.junit.runner.RunWith
      */
-    public OnamiRunner( Class<?> klass )
-        throws InitializationError
-    {
-        super( klass );
-
-        try
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "Inizializing injector for test class: " + 
klass.getName() );
+    public OnamiRunner(Class<?> klass)
+        throws InitializationError {
+        super(klass);
+
+        try {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("Inizializing injector for test class: " + 
klass.getName());
             }
 
-            this.allModules = inizializeInjector( klass );
+            this.allModules = inizializeInjector(klass);
 
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "done..." );
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("done...");
             }
-        }
-        catch ( Exception e )
-        {
+        } catch (Exception e) {
             final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add( e );
-            throw new InitializationError( throwables );
+            throwables.add(e);
+            throw new InitializationError(throwables);
         }
     }
 
     /**
      * OnamiRunner constructor to create the runner needed
      * by the OnamiSuite class.
-     * 
-     * @see org.junit.runner.RunWith
+     *
      * @param suite The suite test case class to run.
-     * @param test The test case class to run.
+     * @param test  The test case class to run.
      * @throws org.junit.runners.model.InitializationError if any error occurs.
+     * @see org.junit.runner.RunWith
      */
-    public OnamiRunner( Class<?> suite, Class<?> test )
-        throws InitializationError
-    {
-        super( test );
-
-        try
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "Inizializing injector for test class: " + 
test.getName() );
+    public OnamiRunner(Class<?> suite, Class<?> test)
+        throws InitializationError {
+        super(test);
+
+        try {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("Inizializing injector for test class: " + 
test.getName());
             }
 
-            this.allModules = inizializeInjector( suite, test );
+            this.allModules = inizializeInjector(suite, test);
 
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "done..." );
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("done...");
             }
-        }
-        catch ( Exception e )
-        {
+        } catch (Exception e) {
             final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add( e );
-            throw new InitializationError( throwables );
+            throwables.add(e);
+            throw new InitializationError(throwables);
         }
     }
 
@@ -214,65 +197,57 @@ public class OnamiRunner
      * {@inheritDoc}
      */
     @Override
-    public void run( final RunNotifier notifier )
-    {
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " ### Run test case: " + 
getTestClass().getJavaClass() + " ### " );
-            LOGGER.finer( " #### Creating injector ####" );
+    public void run(final RunNotifier notifier) {
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" ### Run test case: " + 
getTestClass().getJavaClass() + " ### ");
+            LOGGER.finer(" #### Creating injector ####");
         }
 
-        this.injector = createInjector( allModules );
-        super.run( notifier );
+        this.injector = createInjector(allModules);
+        super.run(notifier);
         this.flush();
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " ### End test case: " + 
getTestClass().getJavaClass().getName() + " ### " );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" ### End test case: " + 
getTestClass().getJavaClass().getName() + " ### ");
         }
     }
 
     /**
      * {@inheritDoc}
      */
-    private void flush()
-    {
+    private void flush() {
         this.injector = null;
         this.allModules.clear();
         this.mocked.clear();
     }
 
     @Override
-    protected void runChild( FrameworkMethod method, RunNotifier notifier )
-    {
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " +++ invoke test method: " + method.getName() + " 
+++ " );
+    protected void runChild(FrameworkMethod method, RunNotifier notifier) {
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" +++ invoke test method: " + method.getName() + " 
+++ ");
         }
 
-        super.runChild( method, notifier );
+        super.runChild(method, notifier);
         resetAllResetAfterMocks();
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " --- end test method: " + method.getName() + " --- 
" );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" --- end test method: " + method.getName() + " --- 
");
         }
     }
 
     /**
      * Creates test instance via Google-Guice to inject all not-static 
dependencies.
+     *
      * @return The instance of the test case.
      * @throws Exception when an error occurs.
      */
     @Override
     protected Object createTest()
-        throws Exception
-    {
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " Create and inject test class: " + 
getTestClass().getJavaClass() );
+        throws Exception {
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" Create and inject test class: " + 
getTestClass().getJavaClass());
         }
-        return this.injector.getInstance( getTestClass().getJavaClass() );
+        return this.injector.getInstance(getTestClass().getJavaClass());
     }
 
     /**
@@ -281,31 +256,28 @@ public class OnamiRunner
      * @param modules the list of modules have to be load
      * @return an Injector instance built using the input Module list
      */
-    protected Injector createInjector( List<Module> modules )
-    {
-        return Guice.createInjector( modules );
+    protected Injector createInjector(List<Module> modules) {
+        return Guice.createInjector(modules);
     }
 
     /**
      * This method collects modules from {@link GuiceModules}, {@link 
GuiceProvidedModules}, {@link Mock}
      * and {@ OnamiSuite}.
      *
-     * @param <T> whatever input type is accepted
+     * @param <T>   whatever input type is accepted
      * @param suite the input suite to be analyzed
-     * @param test the input class has to be analyzed
+     * @param test  the input class has to be analyzed
      * @return a List of Guice Modules built after input class analysis.
      * @throws IllegalAccessException when a n error occurs.
      * @throws InstantiationException when a n error occurs.
-     * @throws HandleException when a n error occurs.
+     * @throws HandleException        when a n error occurs.
      */
-    protected <T> List<Module> inizializeInjector( Class<?> suite, Class<T> 
test)
-        throws HandleException, InstantiationException, IllegalAccessException
-    {
+    protected <T> List<Module> inizializeInjector(Class<?> suite, Class<T> 
test)
+        throws HandleException, InstantiationException, IllegalAccessException 
{
         final List<Module> modules = inizializeInjector(test);
-        Module m = visitClass( suite );
-        if ( m != null )
-        {
-            modules.add( m );
+        Module m = visitClass(suite);
+        if (m != null) {
+            modules.add(m);
         }
         return modules;
     }
@@ -313,34 +285,29 @@ public class OnamiRunner
     /**
      * This method collects modules from {@link GuiceModules}, {@link 
GuiceProvidedModules}, {@link Mock}.
      *
-     * @param <T> whatever input type is accepted
+     * @param <T>   whatever input type is accepted
      * @param clazz the input class has to be analyzed
      * @return a List of Guice Modules built after input class analysis.
      * @throws IllegalAccessException when a n error occurs.
      * @throws InstantiationException when a n error occurs.
-     * @throws HandleException when a n error occurs.
+     * @throws HandleException        when a n error occurs.
      */
-    protected <T> List<Module> inizializeInjector( Class<T> clazz )
-        throws HandleException, InstantiationException, IllegalAccessException
-    {
+    protected <T> List<Module> inizializeInjector(Class<T> clazz)
+        throws HandleException, InstantiationException, IllegalAccessException 
{
         final List<Module> modules = new ArrayList<Module>();
-        Module m = visitClass( clazz );
-        if ( m != null )
-        {
-            modules.add( m );
+        Module m = visitClass(clazz);
+        if (m != null) {
+            modules.add(m);
         }
         return modules;
     }
 
-    private void resetAllResetAfterMocks()
-    {
-        for ( Entry<Field, Object> entry : mocked.entrySet() )
-        {
-            final Mock mockAnnotation = entry.getKey().getAnnotation( 
Mock.class );
-            if ( mockAnnotation.resetAfter() )
-            {
-                MockEngine mockEngine = MockEngineFactory.getMockEngine( 
mockFramework );
-                mockEngine.resetMock( entry.getValue() );
+    private void resetAllResetAfterMocks() {
+        for (Entry<Field, Object> entry : mocked.entrySet()) {
+            final Mock mockAnnotation = 
entry.getKey().getAnnotation(Mock.class);
+            if (mockAnnotation.resetAfter()) {
+                MockEngine mockEngine = 
MockEngineFactory.getMockEngine(mockFramework);
+                mockEngine.resetMock(entry.getValue());
             }
         }
     }
@@ -350,14 +317,11 @@ public class OnamiRunner
      * @throws IllegalAccessException
      * @throws InstantiationException
      */
-    private <T> Module visitClass( final Class<T> clazz )
-        throws HandleException, InstantiationException, IllegalAccessException
-    {
-        try
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "  Start introspecting class: " + 
clazz.getName() );
+    private <T> Module visitClass(final Class<T> clazz)
+        throws HandleException, InstantiationException, IllegalAccessException 
{
+        try {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("  Start introspecting class: " + 
clazz.getName());
             }
             final List<Module> allModules = new ArrayList<Module>();
 
@@ -372,137 +336,114 @@ public class OnamiRunner
 
             // Visit class and super-classes
             new ClassVisitor()
-            .registerHandler( GuiceProvidedModules.class, 
guiceProvidedModuleHandler )
-            .registerHandler( GuiceModules.class, guiceModuleHandler )
-            .registerHandler( Mock.class, mockHandler )
-            .registerHandler( MockFramework.class, mockFrameworkHandler )
-            .registerHandler( com.google.inject.Inject.class, 
guiceInjectableClassHandler )
-            .registerHandler( javax.inject.Inject.class, 
jsr330InjectableClassHandler )
-            .visit( clazz );
+                .registerHandler(GuiceProvidedModules.class, 
guiceProvidedModuleHandler)
+                .registerHandler(GuiceModules.class, guiceModuleHandler)
+                .registerHandler(Mock.class, mockHandler)
+                .registerHandler(MockFramework.class, mockFrameworkHandler)
+                .registerHandler(com.google.inject.Inject.class, 
guiceInjectableClassHandler)
+                .registerHandler(javax.inject.Inject.class, 
jsr330InjectableClassHandler)
+                .visit(clazz);
 
             // Retrieve mock framework
-            if ( mockFrameworkHandler.getMockType() != null )
-            {
+            if (mockFrameworkHandler.getMockType() != null) {
                 this.mockFramework = mockFrameworkHandler.getMockType();
             }
 
             // retrieve the modules founded
-            allModules.addAll( guiceProvidedModuleHandler.getModules() );
-            allModules.addAll( guiceModuleHandler.getModules() );
-            MockEngine engine = MockEngineFactory.getMockEngine( 
this.mockFramework );
-            this.mocked.putAll( mockHandler.getMockedObject( engine ) );
-            if ( !this.mocked.isEmpty() )
-            {
+            allModules.addAll(guiceProvidedModuleHandler.getModules());
+            allModules.addAll(guiceModuleHandler.getModules());
+            MockEngine engine = 
MockEngineFactory.getMockEngine(this.mockFramework);
+            this.mocked.putAll(mockHandler.getMockedObject(engine));
+            if (!this.mocked.isEmpty()) {
                 // Replace all real module binding with Mocked moduled.
-                Module m = Modules.override( allModules ).with( new 
GuiceMockModule( this.mocked ) );
+                Module m = Modules.override(allModules).with(new 
GuiceMockModule(this.mocked));
                 allModules.clear();
-                allModules.add( m );
+                allModules.add(m);
             }
 
             // Add only clasess that have got the Inject annotation
-             final Class<?>[] guiceInjectableClasses = 
guiceInjectableClassHandler.getClasses();
-             final Class<?>[] jsr330InjectableClasses = 
jsr330InjectableClassHandler.getClasses();
+            final Class<?>[] guiceInjectableClasses = 
guiceInjectableClassHandler.getClasses();
+            final Class<?>[] jsr330InjectableClasses = 
jsr330InjectableClassHandler.getClasses();
 
-            final AbstractModule statcInjector = new AbstractModule()
-            {
+            final AbstractModule statcInjector = new AbstractModule() {
                 @Override
-                protected void configure()
-                {
+                protected void configure() {
                     // inject all STATIC dependencies
-                    if ( guiceInjectableClasses.length != 0 )
-                    {
-                        requestStaticInjection( guiceInjectableClasses );
+                    if (guiceInjectableClasses.length != 0) {
+                        requestStaticInjection(guiceInjectableClasses);
                     }
-                    
-                    if ( jsr330InjectableClasses.length != 0 )
-                    {
-                        requestStaticInjection( jsr330InjectableClasses );
+
+                    if (jsr330InjectableClasses.length != 0) {
+                        requestStaticInjection(jsr330InjectableClasses);
                     }
 
-                    
+
                 }
             };
-            if ( guiceInjectableClasses.length != 0 || 
jsr330InjectableClasses.length != 0 )
-            {
-                allModules.add( statcInjector );
+            if (guiceInjectableClasses.length != 0 || 
jsr330InjectableClasses.length != 0) {
+                allModules.add(statcInjector);
             }
 
             // Check if the class is itself a Google Module.
-            if ( Module.class.isAssignableFrom( getTestClass().getJavaClass() 
) )
-            {
-                if ( LOGGER.isLoggable( Level.FINER ) )
-                {
-                    LOGGER.finer( "   creating module from test class " + 
getTestClass().getJavaClass() );
+            if (Module.class.isAssignableFrom(getTestClass().getJavaClass())) {
+                if (LOGGER.isLoggable(Level.FINER)) {
+                    LOGGER.finer("   creating module from test class " + 
getTestClass().getJavaClass());
                 }
                 final Module classModule = (Module) 
getTestClass().getJavaClass().newInstance();
-                allModules.add( classModule );
+                allModules.add(classModule);
             }
 
             // create MockTypeListenerModule
-            if ( this.mocked.size() != 0 )
-            {
-                final AbstractModule mockTypeListenerModule = new 
AbstractModule()
-                {
+            if (this.mocked.size() != 0) {
+                final AbstractModule mockTypeListenerModule = new 
AbstractModule() {
                     @Override
-                    protected void configure()
-                    {
-                        bindListener( Matchers.any(), new MockTypeListener( 
mocked ) );
+                    protected void configure() {
+                        bindListener(Matchers.any(), new 
MockTypeListener(mocked));
                     }
                 };
 
                 // BEGIN patch for issue: google-guice: #452
-                for ( Entry<Field, Object> entry : mocked.entrySet() )
-                {
+                for (Entry<Field, Object> entry : mocked.entrySet()) {
                     final Field field = entry.getKey();
                     final Object mock = entry.getValue();
-                    if ( Modifier.isStatic( field.getModifiers() ) )
-                    {
-                        if ( LOGGER.isLoggable( Level.FINER ) )
-                        {
-                            LOGGER.finer( "   inject static mock field: " + 
field.getName() );
+                    if (Modifier.isStatic(field.getModifiers())) {
+                        if (LOGGER.isLoggable(Level.FINER)) {
+                            LOGGER.finer("   inject static mock field: " + 
field.getName());
                         }
 
-                        AccessController.doPrivileged( new 
PrivilegedAction<Void>()
-                        {
+                        AccessController.doPrivileged(new 
PrivilegedAction<Void>() {
 
-                            public Void run()
-                            {
-                                field.setAccessible( true );
+                            public Void run() {
+                                field.setAccessible(true);
                                 return null;
                             }
 
-                        } );
-                        field.set( field.getDeclaringClass(), mock );
+                        });
+                        field.set(field.getDeclaringClass(), mock);
                     }
                 }
                 // END patch for issue: google-guice: #452
 
-                allModules.add( mockTypeListenerModule );
+                allModules.add(mockTypeListenerModule);
             }
 
-            if ( allModules.size() != 0 )
-            {
-                if ( LOGGER.isLoggable( Level.FINER ) )
-                {
+            if (allModules.size() != 0) {
+                if (LOGGER.isLoggable(Level.FINER)) {
                     StringBuilder builder = new StringBuilder();
-                    builder.append( " Collected modules: " );
-                    builder.append( "\n" );
-                    for ( Module module : allModules )
-                    {
-                        builder.append( "    " ).append( module );
-                        builder.append( "\n" );
+                    builder.append(" Collected modules: ");
+                    builder.append("\n");
+                    for (Module module : allModules) {
+                        builder.append("    ").append(module);
+                        builder.append("\n");
                     }
-                    LOGGER.finer( builder.toString() );
+                    LOGGER.finer(builder.toString());
                 }
-                return Modules.combine( allModules );
+                return Modules.combine(allModules);
             }
             return null;
-        }
-        finally
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( " ...done" );
+        } finally {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer(" ...done");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
index cb7835e..d55f503 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
@@ -70,35 +70,35 @@ import com.google.inject.util.Modules;
  * </p>
  * <p>
  * <b>Example #1:</b> <br>
- * 
+ * <p>
  * <pre>
- * 
+ *
  * &#064;org.junit.runner.RunWith( OnamiSuite.class )
  * &#064;GuiceModules( SimpleModule.class )
  * &#064;SuiteClasses({ .class })
  * public class AcmeTestCase
  * {
- * 
+ *
  *     &#064;GuiceProvidedModules
  *     static public Module getProperties()
  *     {
  *         ...
  *         return Modules.combine(new ComplexModule( loadProperies() ), ...  );
  *     }
- * 
+ *
  * </pre>
- * 
+ * <p>
  * </p>
  * <p>
  * <b>Example #2:</b> <br>
- * 
+ * <p>
  * <pre>
- * 
+ *
  * &#064;org.junit.runner.RunWith( OnamiSuite.class )
  * public class AcmeTestCase
  *     extends com.google.inject.AbstractModule
  * {
- * 
+ *
  *     public void configure()
  *     {
  *         // Configure your proper modules
@@ -106,13 +106,13 @@ import com.google.inject.util.Modules;
  *         bind( Service.class ).annotatedWith( TestAnnotation.class ).to( 
ServiceTestImpl.class );
  *         ...
  *     }
- * 
+ *
  *     &#064;Mock
  *     private AnotherService serviceMock;
- * 
+ *
  *     &#064;Inject
  *     private Service serviceTest;
- * 
+ *
  *     &#064;org.junit.Test
  *     public void test()
  *     {
@@ -120,27 +120,25 @@ import com.google.inject.util.Modules;
  *         assertNotNull( serviceTest );
  *     }
  * </pre>
- * 
+ * <p>
  * </p>
- * 
+ *
  * @see GuiceMockModule
  */
-public class OnamiSuite
-    extends Suite
-{
+public class OnamiSuite extends Suite {
 
-    private static final Logger LOGGER = Logger.getLogger( 
OnamiSuite.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(OnamiSuite.class.getName());
 
     private Injector injector;
 
     private final List<Module> allModules;
 
-    private final Map<Field, Object> mocked = new HashMap<Field, Object>( 1 );
+    private final Map<Field, Object> mocked = new HashMap<Field, Object>(1);
 
     private MockType mockFramework = MockType.EASY_MOCK;
 
     private static Class<?>[] getAnnotatedClasses(Class<?> klass) throws 
InitializationError {
-        SuiteClasses annotation= klass.getAnnotation(SuiteClasses.class);
+        SuiteClasses annotation = klass.getAnnotation(SuiteClasses.class);
         if (annotation == null)
             throw new InitializationError(String.format("class '%s' must have 
a SuiteClasses annotation", klass.getName()));
         return annotation.value();
@@ -148,78 +146,68 @@ public class OnamiSuite
 
     /**
      * OnamiRunner constructor to create the core JUnice class.
-     * 
-     * @see org.junit.runner.RunWith
+     *
      * @param klass The test case class to run.
      * @throws org.junit.runners.model.InitializationError if any error occurs.
+     * @see org.junit.runner.RunWith
      */
-    public OnamiSuite( Class<?> klass, RunnerBuilder builder )
-        throws InitializationError
-    {
+    public OnamiSuite(Class<?> klass, RunnerBuilder builder)
+        throws InitializationError {
         this(builder, klass, getAnnotatedClasses(klass));
 
     }
 
     /**
      * Called by this class and subclasses once the classes making up the 
suite have been determined
-     * 
-     * @param builder builds runners for classes in the suite
-     * @param klass the root of the suite
+     *
+     * @param builder      builds runners for classes in the suite
+     * @param klass        the root of the suite
      * @param suiteClasses the classes in the suite
      * @throws InitializationError
      */
-    protected OnamiSuite( RunnerBuilder builder, Class<?> suite, Class<?>[] 
suiteClasses ) 
-        throws InitializationError 
-    {
-        super( suite, runners( suite, suiteClasses ) );
-        try
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "Inizializing injector for siote class: " + 
suite.getName() );
+    protected OnamiSuite(RunnerBuilder builder, Class<?> suite, Class<?>[] 
suiteClasses)
+        throws InitializationError {
+        super(suite, runners(suite, suiteClasses));
+        try {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("Inizializing injector for siote class: " + 
suite.getName());
             }
 
-            this.allModules = inizializeInjector( suite );
+            this.allModules = inizializeInjector(suite);
 
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "done..." );
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("done...");
             }
-        }
-        catch ( Exception e )
-        {
+        } catch (Exception e) {
             final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add( e );
-            throw new InitializationError( throwables );
+            throwables.add(e);
+            throw new InitializationError(throwables);
         }
     }
-    
+
     /**
      * {@inheritDoc}
      */
     @Override
-    public void run( final RunNotifier notifier )
-    {
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " ### Run test case: " + 
getTestClass().getJavaClass() + " ### " );
-            LOGGER.finer( " #### Creating injector ####" );
+    public void run(final RunNotifier notifier) {
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" ### Run test case: " + 
getTestClass().getJavaClass() + " ### ");
+            LOGGER.finer(" #### Creating injector ####");
         }
 
-        this.injector = createInjector( allModules );
-        super.run( notifier );
+        this.injector = createInjector(allModules);
+        super.run(notifier);
         this.flush();
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " ### End test case: " + 
getTestClass().getJavaClass().getName() + " ### " );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" ### End test case: " + 
getTestClass().getJavaClass().getName() + " ### ");
         }
     }
 
-    private static List<Runner> runners( Class<?> suite, Class<?>[] children ) 
throws InitializationError {
-        ArrayList<Runner> runners= new ArrayList<Runner>();
+    private static List<Runner> runners(Class<?> suite, Class<?>[] children) 
throws InitializationError {
+        ArrayList<Runner> runners = new ArrayList<Runner>();
         for (Class<?> each : children) {
-            Runner childRunner= new OnamiRunner( suite, each );
+            Runner childRunner = new OnamiRunner(suite, each);
             if (childRunner != null)
                 runners.add(childRunner);
         }
@@ -229,27 +217,23 @@ public class OnamiSuite
     /**
      * {@inheritDoc}
      */
-    private void flush()
-    {
+    private void flush() {
         this.injector = null;
         this.allModules.clear();
         this.mocked.clear();
     }
 
     @Override
-    protected void runChild( Runner runner, RunNotifier notifier )
-    {
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " +++ invoke runner: " + runner + " +++ " );
+    protected void runChild(Runner runner, RunNotifier notifier) {
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" +++ invoke runner: " + runner + " +++ ");
         }
 
-        super.runChild( runner, notifier );
+        super.runChild(runner, notifier);
         resetAllResetAfterMocks();
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( " --- end runner: " + runner + " --- " );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(" --- end runner: " + runner + " --- ");
         }
     }
 
@@ -259,42 +243,36 @@ public class OnamiSuite
      * @param modules the list of modules have to be load
      * @return an Injector instance built using the input Module list
      */
-    protected Injector createInjector( List<Module> modules )
-    {
-        return Guice.createInjector( modules );
+    protected Injector createInjector(List<Module> modules) {
+        return Guice.createInjector(modules);
     }
 
     /**
      * This method collects modules from {@link GuiceModules}, {@link 
GuiceProvidedModules}, {@link Mock}.
      *
-     * @param <T> whatever input type is accepted
+     * @param <T>   whatever input type is accepted
      * @param clazz the input class has to be analyzed
      * @return a List of Guice Modules built after input class analysis.
      * @throws IllegalAccessException when a n error occurs.
      * @throws InstantiationException when a n error occurs.
-     * @throws HandleException when a n error occurs.
+     * @throws HandleException        when a n error occurs.
      */
-    protected <T> List<Module> inizializeInjector( Class<T> clazz )
-        throws HandleException, InstantiationException, IllegalAccessException
-    {
+    protected <T> List<Module> inizializeInjector(Class<T> clazz)
+        throws HandleException, InstantiationException, IllegalAccessException 
{
         final List<Module> modules = new ArrayList<Module>();
-        Module m = visitClass( clazz );
-        if ( m != null )
-        {
-            modules.add( m );
+        Module m = visitClass(clazz);
+        if (m != null) {
+            modules.add(m);
         }
         return modules;
     }
 
-    private void resetAllResetAfterMocks()
-    {
-        for ( Entry<Field, Object> entry : mocked.entrySet() )
-        {
-            final Mock mockAnnotation = entry.getKey().getAnnotation( 
Mock.class );
-            if ( mockAnnotation.resetAfter() )
-            {
-                MockEngine mockEngine = MockEngineFactory.getMockEngine( 
mockFramework );
-                mockEngine.resetMock( entry.getValue() );
+    private void resetAllResetAfterMocks() {
+        for (Entry<Field, Object> entry : mocked.entrySet()) {
+            final Mock mockAnnotation = 
entry.getKey().getAnnotation(Mock.class);
+            if (mockAnnotation.resetAfter()) {
+                MockEngine mockEngine = 
MockEngineFactory.getMockEngine(mockFramework);
+                mockEngine.resetMock(entry.getValue());
             }
         }
     }
@@ -304,14 +282,11 @@ public class OnamiSuite
      * @throws IllegalAccessException
      * @throws InstantiationException
      */
-    private <T> Module visitClass( final Class<T> clazz )
-        throws HandleException, InstantiationException, IllegalAccessException
-    {
-        try
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "  Start introspecting class: " + 
clazz.getName() );
+    private <T> Module visitClass(final Class<T> clazz)
+        throws HandleException, InstantiationException, IllegalAccessException 
{
+        try {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("  Start introspecting class: " + 
clazz.getName());
             }
             final List<Module> allModules = new ArrayList<Module>();
 
@@ -326,137 +301,110 @@ public class OnamiSuite
 
             // Visit class and super-classes
             new ClassVisitor()
-            .registerHandler( GuiceProvidedModules.class, 
guiceProvidedModuleHandler )
-            .registerHandler( GuiceModules.class, guiceModuleHandler )
-            .registerHandler( Mock.class, mockHandler )
-            .registerHandler( MockFramework.class, mockFrameworkHandler )
-            .registerHandler( Inject.class, guiceInjectableClassHandler )
-            .registerHandler( javax.inject.Inject.class, 
jsr330InjectableClassHandler )
-            .visit( clazz );
+                .registerHandler(GuiceProvidedModules.class, 
guiceProvidedModuleHandler)
+                .registerHandler(GuiceModules.class, guiceModuleHandler)
+                .registerHandler(Mock.class, mockHandler)
+                .registerHandler(MockFramework.class, mockFrameworkHandler)
+                .registerHandler(Inject.class, guiceInjectableClassHandler)
+                .registerHandler(javax.inject.Inject.class, 
jsr330InjectableClassHandler)
+                .visit(clazz);
 
             // Retrieve mock framework
-            if ( mockFrameworkHandler.getMockType() != null )
-            {
+            if (mockFrameworkHandler.getMockType() != null) {
                 this.mockFramework = mockFrameworkHandler.getMockType();
             }
 
             // retrieve the modules founded
-            allModules.addAll( guiceProvidedModuleHandler.getModules() );
-            allModules.addAll( guiceModuleHandler.getModules() );
-            MockEngine engine = MockEngineFactory.getMockEngine( 
this.mockFramework );
-            this.mocked.putAll( mockHandler.getMockedObject( engine ) );
-            if ( !this.mocked.isEmpty() )
-            {
+            allModules.addAll(guiceProvidedModuleHandler.getModules());
+            allModules.addAll(guiceModuleHandler.getModules());
+            MockEngine engine = 
MockEngineFactory.getMockEngine(this.mockFramework);
+            this.mocked.putAll(mockHandler.getMockedObject(engine));
+            if (!this.mocked.isEmpty()) {
                 // Replace all real module binding with Mocked moduled.
-                Module m = Modules.override( allModules ).with( new 
GuiceMockModule( this.mocked ) );
+                Module m = Modules.override(allModules).with(new 
GuiceMockModule(this.mocked));
                 allModules.clear();
-                allModules.add( m );
+                allModules.add(m);
             }
 
             // Add only clasess that have got the Inject annotation
-             final Class<?>[] guiceInjectableClasses = 
guiceInjectableClassHandler.getClasses();
-             final Class<?>[] jsr330InjectableClasses = 
jsr330InjectableClassHandler.getClasses();
+            final Class<?>[] guiceInjectableClasses = 
guiceInjectableClassHandler.getClasses();
+            final Class<?>[] jsr330InjectableClasses = 
jsr330InjectableClassHandler.getClasses();
 
-            final AbstractModule statcInjector = new AbstractModule()
-            {
+            final AbstractModule statcInjector = new AbstractModule() {
                 @Override
-                protected void configure()
-                {
+                protected void configure() {
                     // inject all STATIC dependencies
-                    if ( guiceInjectableClasses.length != 0 )
-                    {
-                        requestStaticInjection( guiceInjectableClasses );
-                    }
-                    
-                    if ( jsr330InjectableClasses.length != 0 )
-                    {
-                        requestStaticInjection( jsr330InjectableClasses );
+                    if (guiceInjectableClasses.length != 0) {
+                        requestStaticInjection(guiceInjectableClasses);
                     }
 
-                    
+                    if (jsr330InjectableClasses.length != 0) {
+                        requestStaticInjection(jsr330InjectableClasses);
+                    }
                 }
             };
-            if ( guiceInjectableClasses.length != 0 || 
jsr330InjectableClasses.length != 0 )
-            {
-                allModules.add( statcInjector );
+            if (guiceInjectableClasses.length != 0 || 
jsr330InjectableClasses.length != 0) {
+                allModules.add(statcInjector);
             }
 
             // Check if the class is itself a Google Module.
-            if ( Module.class.isAssignableFrom( getTestClass().getJavaClass() 
) )
-            {
-                if ( LOGGER.isLoggable( Level.FINER ) )
-                {
-                    LOGGER.finer( "   creating module from test class " + 
getTestClass().getJavaClass() );
+            if (Module.class.isAssignableFrom(getTestClass().getJavaClass())) {
+                if (LOGGER.isLoggable(Level.FINER)) {
+                    LOGGER.finer("   creating module from test class " + 
getTestClass().getJavaClass());
                 }
                 final Module classModule = (Module) 
getTestClass().getJavaClass().newInstance();
-                allModules.add( classModule );
+                allModules.add(classModule);
             }
 
             // create MockTypeListenerModule
-            if ( this.mocked.size() != 0 )
-            {
-                final AbstractModule mockTypeListenerModule = new 
AbstractModule()
-                {
+            if (this.mocked.size() != 0) {
+                final AbstractModule mockTypeListenerModule = new 
AbstractModule() {
                     @Override
-                    protected void configure()
-                    {
-                        bindListener( Matchers.any(), new MockTypeListener( 
mocked ) );
+                    protected void configure() {
+                        bindListener(Matchers.any(), new 
MockTypeListener(mocked));
                     }
                 };
 
                 // BEGIN patch for issue: google-guice: #452
-                for ( Entry<Field, Object> entry : mocked.entrySet() )
-                {
+                for (Entry<Field, Object> entry : mocked.entrySet()) {
                     final Field field = entry.getKey();
                     final Object mock = entry.getValue();
-                    if ( Modifier.isStatic( field.getModifiers() ) )
-                    {
-                        if ( LOGGER.isLoggable( Level.FINER ) )
-                        {
-                            LOGGER.finer( "   inject static mock field: " + 
field.getName() );
+                    if (Modifier.isStatic(field.getModifiers())) {
+                        if (LOGGER.isLoggable(Level.FINER)) {
+                            LOGGER.finer("   inject static mock field: " + 
field.getName());
                         }
+                        AccessController.doPrivileged(new 
PrivilegedAction<Void>() {
 
-                        AccessController.doPrivileged( new 
PrivilegedAction<Void>()
-                        {
-
-                            public Void run()
-                            {
-                                field.setAccessible( true );
+                            public Void run() {
+                                field.setAccessible(true);
                                 return null;
                             }
 
-                        } );
-                        field.set( field.getDeclaringClass(), mock );
+                        });
+                        field.set(field.getDeclaringClass(), mock);
                     }
                 }
                 // END patch for issue: google-guice: #452
-
-                allModules.add( mockTypeListenerModule );
+                allModules.add(mockTypeListenerModule);
             }
 
-            if ( allModules.size() != 0 )
-            {
-                if ( LOGGER.isLoggable( Level.FINER ) )
-                {
+            if (allModules.size() != 0) {
+                if (LOGGER.isLoggable(Level.FINER)) {
                     StringBuilder builder = new StringBuilder();
-                    builder.append( " Collected modules: " );
-                    builder.append( "\n" );
-                    for ( Module module : allModules )
-                    {
-                        builder.append( "    " ).append( module );
-                        builder.append( "\n" );
+                    builder.append(" Collected modules: ");
+                    builder.append("\n");
+                    for (Module module : allModules) {
+                        builder.append("    ").append(module);
+                        builder.append("\n");
                     }
-                    LOGGER.finer( builder.toString() );
+                    LOGGER.finer(builder.toString());
                 }
-                return Modules.combine( allModules );
+                return Modules.combine(allModules);
             }
             return null;
-        }
-        finally
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( " ...done" );
+        } finally {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer(" ...done");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
index fe98e07..075f552 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
@@ -29,10 +29,9 @@ import com.google.inject.Module;
 /**
  * Annotate your class to define a list of Google Guice {@link Module} whit 
default constructor.
  */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
-public @interface GuiceModules
-{
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface GuiceModules {
 
     /**
      * List of Google Guice {@link Module}.

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceProvidedModules.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceProvidedModules.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceProvidedModules.java
index bd36d22..1213142 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceProvidedModules.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceProvidedModules.java
@@ -36,9 +36,8 @@ import java.lang.annotation.Target;
  * <li>com.google.inject.Module[]</li>
  * </p>
  */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.METHOD )
-public @interface GuiceProvidedModules
-{
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface GuiceProvidedModules {
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/Mock.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/Mock.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/Mock.java
index 5695e51..d2e32fa 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/Mock.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/Mock.java
@@ -29,17 +29,15 @@ import java.lang.annotation.Target;
 /**
  * Annotate your filed into which {@link 
org.apache.onami.test.GuiceMockModule} will create and inject the mock object.
  */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.FIELD )
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
 @Inherited
-public @interface Mock
-{
+public @interface Mock {
 
     /**
      * Annotation class used to mark that no annotation binding is defined.
      */
-    public static @interface NoAnnotation
-    {
+    public static @interface NoAnnotation {
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockFramework.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockFramework.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockFramework.java
index d695453..3e057f7 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockFramework.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockFramework.java
@@ -27,10 +27,9 @@ import java.lang.annotation.Target;
 /**
  * Annotate test class to specify you favorite mock framework.
  */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
-public @interface MockFramework
-{
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface MockFramework {
 
     /**
      * Type of mock that JUnice has to create.

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockObjType.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockObjType.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockObjType.java
index e3e4eac..ce684b1 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockObjType.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockObjType.java
@@ -22,25 +22,24 @@ package org.apache.james.mpt.onami.test.annotation;
 /**
  * Enumeration class to specifies the preferred mock object.
  */
-public enum MockObjType
-{
+public enum MockObjType {
 
-    /** 
+    /**
      * @see EasyMock.createMock
      */
     EASY_MOCK_NORMAL,
-    
-    /** 
+
+    /**
      * @see EasyMock.createStrictMock
      */
     EASY_MOCK_STRICT,
-    
-    /** 
+
+    /**
      * @see EasyMock.createNiceMock
      */
     EASY_MOCK_NICE,
-    
-    /** 
+
+    /**
      * Use default mock creation mode
      */
     DEFAULT

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockType.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockType.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockType.java
index 57f2810..1082464 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockType.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/MockType.java
@@ -24,13 +24,12 @@ package org.apache.james.mpt.onami.test.annotation;
  *
  * @see MockFramework
  */
-public enum MockType
-{
+public enum MockType {
     /**
      * Identify the Easy Mock framework
      */
-    EASY_MOCK, 
-    
+    EASY_MOCK,
+
     /**
      * Identify the Mockito framework
      */

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockMembersInjector.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockMembersInjector.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockMembersInjector.java
index d8f05ce..6ce31ac 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockMembersInjector.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockMembersInjector.java
@@ -31,9 +31,7 @@ import com.google.inject.MembersInjector;
  *
  * @param <T> type to inject members of
  */
-public class MockMembersInjector<T>
-    implements MembersInjector<T>
-{
+public class MockMembersInjector<T> implements MembersInjector<T> {
 
     private final Field field;
 
@@ -41,38 +39,31 @@ public class MockMembersInjector<T>
 
     /**
      * Create a new instance.
-     * 
-     * @param field the field that has to be injected.
-     * @param mockedObjects  the map of mocked object.
+     *
+     * @param field         the field that has to be injected.
+     * @param mockedObjects the map of mocked object.
      */
-    public MockMembersInjector( final Field field, Map<Field, Object> 
mockedObjects )
-    {
+    public MockMembersInjector(final Field field, Map<Field, Object> 
mockedObjects) {
         this.field = field;
         this.mockedObjects = mockedObjects;
-        AccessController.doPrivileged( new PrivilegedAction<Void>()
-        {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
 
-            public Void run()
-            {
-                field.setAccessible( true );
+            public Void run() {
+                field.setAccessible(true);
                 return null;
             }
 
-        } );
+        });
     }
 
     /**
      * {@inheritDoc}
      */
-    public void injectMembers( T t )
-    {
-        try
-        {
-            field.set( t, mockedObjects.get( field ) );
-        }
-        catch ( IllegalAccessException e )
-        {
-            throw new RuntimeException( e );
+    public void injectMembers(T t) {
+        try {
+            field.set(t, mockedObjects.get(field));
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockTypeListener.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockTypeListener.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockTypeListener.java
index 427fab8..1a6964e 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockTypeListener.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/guice/MockTypeListener.java
@@ -42,9 +42,7 @@ import com.google.inject.spi.TypeListener;
  * @see MockMembersInjector
  * @see Mock
  */
-public class MockTypeListener
-    implements TypeListener
-{
+public class MockTypeListener implements TypeListener {
 
     private final Map<Field, Object> mockedObjects;
 
@@ -53,34 +51,27 @@ public class MockTypeListener
      *
      * @param mockedObjects a map of mocked objects
      */
-    public MockTypeListener( Map<Field, Object> mockedObjects )
-    {
+    public MockTypeListener(Map<Field, Object> mockedObjects) {
         this.mockedObjects = mockedObjects;
     }
 
     /**
      * {@inheritDoc}
      */
-    public <I> void hear( final TypeLiteral<I> typeLiteral, final 
TypeEncounter<I> typeEncounter )
-    {
-        try
-        {
+    public <I> void hear(final TypeLiteral<I> typeLiteral, final 
TypeEncounter<I> typeEncounter) {
+        try {
             new ClassVisitor()
-            .registerHandler( Mock.class, new AnnotationHandler<Mock, Field>()
-            {
+                .registerHandler(Mock.class, new AnnotationHandler<Mock, 
Field>() {
 
-                public void handle( Mock annotation, Field field )
-                    throws HandleException
-                {
-                    typeEncounter.register( new MockMembersInjector<I>( field, 
mockedObjects ) );
-                }
+                    public void handle(Mock annotation, Field field)
+                        throws HandleException {
+                        typeEncounter.register(new 
MockMembersInjector<I>(field, mockedObjects));
+                    }
 
-            } )
-            .visit( typeLiteral.getRawType() );
-        }
-        catch ( HandleException e )
-        {
-            typeEncounter.addError( e );
+                })
+                .visit(typeLiteral.getRawType());
+        } catch (HandleException e) {
+            typeEncounter.addError(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceInjectableClassHandler.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceInjectableClassHandler.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceInjectableClassHandler.java
index 936e4ed..3cc27f7 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceInjectableClassHandler.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceInjectableClassHandler.java
@@ -36,11 +36,9 @@ import 
org.apache.james.mpt.onami.test.reflection.HandleException;
  * @param <A> whatever annotation type
  * @see org.apache.onami.test.reflection.ClassVisitor
  */
-public final class GuiceInjectableClassHandler<A extends Annotation>
-    implements AnnotationHandler<A, AccessibleObject>
-{
+public final class GuiceInjectableClassHandler<A extends Annotation> 
implements AnnotationHandler<A, AccessibleObject> {
 
-    private static final Logger LOGGER = Logger.getLogger( 
GuiceInjectableClassHandler.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(GuiceInjectableClassHandler.class.getName());
 
     /**
      * Contains the guice injectable classes founded, after inspection.
@@ -53,31 +51,26 @@ public final class GuiceInjectableClassHandler<A extends 
Annotation>
      *
      * @return {@link Class} array.
      */
-    public Class<?>[] getClasses()
-    {
-        return classes.toArray( new Class<?>[classes.size()] );
+    public Class<?>[] getClasses() {
+        return classes.toArray(new Class<?>[classes.size()]);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void handle( A annotation, AccessibleObject element )
-        throws HandleException
-    {
+    public void handle(A annotation, AccessibleObject element)
+        throws HandleException {
         Class<?> type = null;
 
-        if ( element instanceof Member )
-        {
-            type = ( (Member) element ).getDeclaringClass();
+        if (element instanceof Member) {
+            type = ((Member) element).getDeclaringClass();
         }
 
-        if ( type != null && !classes.contains( type ) )
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "   Found injectable type: " + type );
+        if (type != null && !classes.contains(type)) {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("   Found injectable type: " + type);
             }
-            classes.add( type );
+            classes.add(type);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceModuleHandler.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceModuleHandler.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceModuleHandler.java
index 718604d..3181157 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceModuleHandler.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceModuleHandler.java
@@ -35,41 +35,32 @@ import com.google.inject.Module;
  *
  * @see org.apache.onami.test.reflection.ClassVisitor
  */
-public final class GuiceModuleHandler
-    implements ClassHandler<GuiceModules>
-{
+public final class GuiceModuleHandler implements ClassHandler<GuiceModules> {
 
-    private static final Logger LOGGER = Logger.getLogger( 
GuiceModuleHandler.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(GuiceModuleHandler.class.getName());
 
     private final List<Module> modules = new ArrayList<Module>();
 
     /**
      * @return the modules
      */
-    public List<Module> getModules()
-    {
+    public List<Module> getModules() {
         return modules;
     }
 
     /**
      * {@inheritDoc}
      */
-    public void handle( GuiceModules annotation, Class<?> element )
-        throws HandleException
-    {
-        for ( Class<? extends Module> module : annotation.value() )
-        {
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "   Try to create module: " + module );
+    public void handle(GuiceModules annotation, Class<?> element)
+        throws HandleException {
+        for (Class<? extends Module> module : annotation.value()) {
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("   Try to create module: " + module);
             }
-            try
-            {
-                modules.add( module.newInstance() );
-            }
-            catch ( Exception e )
-            {
-                throw new HandleException( e );
+            try {
+                modules.add(module.newInstance());
+            } catch (Exception e) {
+                throw new HandleException(e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceProvidedModuleHandler.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceProvidedModuleHandler.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceProvidedModuleHandler.java
index 9c7b365..ed9ed7b 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceProvidedModuleHandler.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/GuiceProvidedModuleHandler.java
@@ -42,96 +42,74 @@ import com.google.inject.TypeLiteral;
  * @see org.apache.onami.test.reflection.ClassVisitor
  * @see GuiceProvidedModules
  */
-public final class GuiceProvidedModuleHandler
-    implements MethodHandler<GuiceProvidedModules>
-{
+public final class GuiceProvidedModuleHandler implements 
MethodHandler<GuiceProvidedModules> {
 
-    private static final Logger LOGGER = Logger.getLogger( 
GuiceProvidedModuleHandler.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(GuiceProvidedModuleHandler.class.getName());
 
     private final List<Module> modules = new ArrayList<Module>();
 
     /**
      * @return the guiceProviderModuleRegistry
      */
-    public List<Module> getModules()
-    {
+    public List<Module> getModules() {
         return modules;
     }
 
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings( "unchecked" )
-    public void handle( GuiceProvidedModules annotation, Method method )
-        throws HandleException
-    {
+    @SuppressWarnings("unchecked")
+    public void handle(GuiceProvidedModules annotation, Method method)
+        throws HandleException {
         final Class<?> returnType = method.getReturnType();
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( format( "  Found %s annotated method, checking if 
return type '%s' is one of ( %s | Iterable<%s> | %s[] )",
-                                  GuiceProvidedModules.class.getSimpleName(),
-                                  returnType.getName(),
-                                  Module.class.getName(),
-                                  Module.class.getName(),
-                                  Module.class.getName() ) );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer(format("  Found %s annotated method, checking if 
return type '%s' is one of ( %s | Iterable<%s> | %s[] )",
+                GuiceProvidedModules.class.getSimpleName(),
+                returnType.getName(),
+                Module.class.getName(),
+                Module.class.getName(),
+                Module.class.getName()));
         }
 
-        if ( !Modifier.isPublic( method.getModifiers() ) || 
!Modifier.isStatic( method.getModifiers() ) )
-        {
-            throw new HandleException( "Impossible to invoke method: " + 
method + ", it has to be static and public" );
+        if (!Modifier.isPublic(method.getModifiers()) || 
!Modifier.isStatic(method.getModifiers())) {
+            throw new HandleException("Impossible to invoke method: " + method 
+ ", it has to be static and public");
         }
 
         final Class<?> type = method.getDeclaringClass();
 
-        try
-        {
-            if ( Module.class.isAssignableFrom( returnType ) )
-            {
-                modules.add( (Module) method.invoke( type ) );
-            }
-            else if ( new TypeLiteral<Iterable<Module>>()
-            {
-            }.getRawType().isAssignableFrom( returnType ) )
-            {
-                addModules( (Iterable<Module>) method.invoke( type ) );
-            }
-            else if ( new TypeLiteral<Module[]>()
-            {
-            }.getRawType().isAssignableFrom( returnType ) )
-            {
-                addModules( (Module[]) method.invoke( type ) );
-            }
-            else
-            {
-                throw new ClassCastException( format( "  Incompatible return 
type: %s.\nThe return type must be one of ( %s | Iterable<%s> | %s[] )",
-                                                      returnType.getName(),
-                                                      Module.class.getName(),
-                                                      Module.class.getName(),
-                                                      Module.class.getName() ) 
);
+        try {
+            if (Module.class.isAssignableFrom(returnType)) {
+                modules.add((Module) method.invoke(type));
+            } else if (new TypeLiteral<Iterable<Module>>() {
+            }.getRawType().isAssignableFrom(returnType)) {
+                addModules((Iterable<Module>) method.invoke(type));
+            } else if (new TypeLiteral<Module[]>() {
+            }.getRawType().isAssignableFrom(returnType)) {
+                addModules((Module[]) method.invoke(type));
+            } else {
+                throw new ClassCastException(format("  Incompatible return 
type: %s.\nThe return type must be one of ( %s | Iterable<%s> | %s[] )",
+                    returnType.getName(),
+                    Module.class.getName(),
+                    Module.class.getName(),
+                    Module.class.getName()));
             }
 
-            if ( LOGGER.isLoggable( Level.FINER ) )
-            {
-                LOGGER.finer( "  Invoked method: " + method.toGenericString() 
);
+            if (LOGGER.isLoggable(Level.FINER)) {
+                LOGGER.finer("  Invoked method: " + method.toGenericString());
             }
-        }
-        catch ( Exception e )
-        {
-            throw new HandleException( e );
+        } catch (Exception e) {
+            throw new HandleException(e);
         }
     }
 
-    private void addModules( Iterable<Module> modules )
-    {
-        for ( Module module : modules )
-        {
-            this.modules.add( module );
+    private void addModules(Iterable<Module> modules) {
+        for (Module module : modules) {
+            this.modules.add(module);
         }
     }
 
-    private void addModules( Module... modules )
-    {
-        Collections.addAll( this.modules, modules );
+    private void addModules(Module... modules) {
+        Collections.addAll(this.modules, modules);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7adbc83c/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/MockFrameworkHandler.java
----------------------------------------------------------------------
diff --git 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/MockFrameworkHandler.java
 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/MockFrameworkHandler.java
index 32b1284..e6b4433 100644
--- 
a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/MockFrameworkHandler.java
+++ 
b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/handler/MockFrameworkHandler.java
@@ -33,37 +33,31 @@ import 
org.apache.james.mpt.onami.test.reflection.HandleException;
  * @see org.apache.onami.test.reflection.ClassVisitor
  * @see MockFramework
  */
-public final class MockFrameworkHandler
-    implements ClassHandler<MockFramework>
-{
+public final class MockFrameworkHandler implements ClassHandler<MockFramework> 
{
 
-    private static final Logger LOGGER = Logger.getLogger( 
MockFrameworkHandler.class.getName() );
+    private static final Logger LOGGER = 
Logger.getLogger(MockFrameworkHandler.class.getName());
 
     private MockType mockType;
 
     /**
      * @return the mockType
      */
-    public MockType getMockType()
-    {
+    public MockType getMockType() {
         return mockType;
     }
 
     /**
      * {@inheritDoc}
      */
-    public void handle( MockFramework annotation, Class<?> element )
-        throws HandleException
-    {
-        if ( mockType != null && mockType != annotation.value() )
-        {
-            throw new HandleException( "Inconsistent mock framework found. " + 
"Mock framework already set [set: "
-                + mockType + " now found: " + annotation.value() + "]" );
+    public void handle(MockFramework annotation, Class<?> element)
+        throws HandleException {
+        if (mockType != null && mockType != annotation.value()) {
+            throw new HandleException("Inconsistent mock framework found. " + 
"Mock framework already set [set: "
+                + mockType + " now found: " + annotation.value() + "]");
         }
 
-        if ( LOGGER.isLoggable( Level.FINER ) )
-        {
-            LOGGER.finer( "  Found MockFramework: " + annotation.value() );
+        if (LOGGER.isLoggable(Level.FINER)) {
+            LOGGER.finer("  Found MockFramework: " + annotation.value());
         }
 
         mockType = annotation.value();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to