de.akquinet.jbosscc.needle.junit
Class NeedleRule

java.lang.Object
  extended by de.akquinet.jbosscc.needle.NeedleTestcase
      extended by de.akquinet.jbosscc.needle.junit.NeedleRule
All Implemented Interfaces:
org.junit.rules.MethodRule

public class NeedleRule
extends NeedleTestcase
implements org.junit.rules.MethodRule

JUnit MethodRule for the initialization of the test. The Rule processes and initializes all fields annotated with ObjectUnderTest.

 Example:
 
 public class UserDaoBeanTest {
 
        @Rule
        public NeedleRule needle = new NeedleRule();
 
        @ObjectUnderTest
        private UserDaoBean userDao;
 
        @Test
        public void test() {
         ...
         userDao.someAction();
         ...
        }
 }
 
 

See Also:
NeedleTestcase

Constructor Summary
NeedleRule()
           
NeedleRule(InjectionProvider<?>... injectionProvider)
           
 
Method Summary
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
           Before evaluation of the base statement, the test instance will initialized.
 NeedleRule withOuter(org.junit.rules.MethodRule rule)
          Encloses the added rule.
 
Methods inherited from class de.akquinet.jbosscc.needle.NeedleTestcase
addInjectionProvider, getInjectedObject, getMockProvider, initInstance, initTestcase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeedleRule

public NeedleRule()

NeedleRule

public NeedleRule(InjectionProvider<?>... injectionProvider)
See Also:
NeedleTestcase.NeedleTestcase(InjectionProvider...)
Method Detail

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
                                               org.junit.runners.model.FrameworkMethod method,
                                               Object target)
Before evaluation of the base statement, the test instance will initialized.

Specified by:
apply in interface org.junit.rules.MethodRule

withOuter

public NeedleRule withOuter(org.junit.rules.MethodRule rule)
Encloses the added rule.

Parameters:
rule - - outer method rule
Returns:
NeedleRule


Copyright © 2013 akquinet AG. All Rights Reserved.