JSF Test Framework: Mockito 1.1.2

org.jboss.test.faces.mockito.runner
Class FacesMockitoRunner

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
          extended by org.junit.runners.BlockJUnit4ClassRunner
              extended by org.jboss.test.faces.mockito.runner.FacesMockitoRunner
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable

public class FacesMockitoRunner
extends org.junit.runners.BlockJUnit4ClassRunner

JUnit runner for running mocked JSF environment.

It initialized MockFacesEnvironment and is able to inject mocked JSF classes held by MockFacesEnvironment to current test instance.

Similarly to MockitoJUnitRunner, it uses MockitoAnnotations.initMocks(Object) on test instance to mock all the test dependencies annotated by Mockito annotations.

TODO cleanup of injections TODO create tests for failures

Author:
Lukas Fryc

Constructor Summary
FacesMockitoRunner(Class<?> klass)
          Instantiates a new faces mockito runner.
 
Method Summary
 void run(org.junit.runner.notification.RunNotifier notifier)
           
protected  void runAfter(Object target)
          Run after each test
protected  void runBefore(Object target)
          Run before each test
protected  org.junit.runners.model.Statement withAfters(org.junit.runners.model.FrameworkMethod method, Object target, org.junit.runners.model.Statement originalStatement)
           
protected  org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod method, Object target, org.junit.runners.model.Statement originalStatement)
           
 
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, methodBlock, methodInvoker, possiblyExpectingExceptions, runChild, testName, validateConstructor, validateInstanceMethods, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withPotentialTimeout
 
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, filter, getDescription, getName, getTestClass, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
 
Methods inherited from class org.junit.runner.Runner
testCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesMockitoRunner

public FacesMockitoRunner(Class<?> klass)
                   throws org.junit.runners.model.InitializationError
Instantiates a new faces mockito runner.

Parameters:
klass - the class
Throws:
org.junit.runners.model.InitializationError - the initialization error
Method Detail

run

public void run(org.junit.runner.notification.RunNotifier notifier)
Overrides:
run in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>

withBefores

protected org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod method,
                                                        Object target,
                                                        org.junit.runners.model.Statement originalStatement)
Overrides:
withBefores in class org.junit.runners.BlockJUnit4ClassRunner

withAfters

protected org.junit.runners.model.Statement withAfters(org.junit.runners.model.FrameworkMethod method,
                                                       Object target,
                                                       org.junit.runners.model.Statement originalStatement)
Overrides:
withAfters in class org.junit.runners.BlockJUnit4ClassRunner

runBefore

protected void runBefore(Object target)
Run before each test

Parameters:
target - the target test instance

runAfter

protected void runAfter(Object target)
Run after each test

Parameters:
target - the target test instance

JSF Test Framework: Mockito 1.1.2

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.