Coverage Report - org.apache.onami.test.MockEngineFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
MockEngineFactory
50%
3/6
66%
2/3
3.5
MockEngineFactory$1
100%
1/1
N/A
3.5
 
 1  
 package org.apache.onami.test;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.onami.test.annotation.MockType;
 23  
 import org.apache.onami.test.mock.MockEngine;
 24  
 import org.apache.onami.test.mock.framework.EasyMockFramework;
 25  
 import org.apache.onami.test.mock.framework.MockitoFramework;
 26  
 
 27  
 /**
 28  
  * Factory class to create the mock framework.
 29  
  * 
 30  
  * @see org.apache.onami.test.annotation.MockFramework
 31  
  */
 32  
 final class MockEngineFactory
 33  
 {
 34  
 
 35  
     /**
 36  
      * Hidden constructor, this class must not be instantiated directly.
 37  
      */
 38  
     private MockEngineFactory()
 39  0
     {
 40  
         // do nothing
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Mock factory constructor. <br>
 45  
      * Supported framewors: <li> {@link MockType}.EASY_MOCK <li> {@link MockType}.MOCKITO <br>
 46  
      *
 47  
      * @see MockType
 48  
      * @param type of mock framework to create.
 49  
      * @return An instance of mock framework.
 50  
      */
 51  
     public static MockEngine getMockEngine( MockType type )
 52  
     {
 53  33
         switch ( type )
 54  
         {
 55  
             case EASY_MOCK:
 56  30
                 return new EasyMockFramework();
 57  
 
 58  
             case MOCKITO:
 59  3
                 return new MockitoFramework();
 60  
 
 61  
             default:
 62  0
                 throw new IllegalArgumentException( "Unrecognized MockType '" + type.name() + "'" );
 63  
         }
 64  
     }
 65  
 
 66  
 }