org.apache.felix.ipojo.junit4osgi
Class OSGiTestSuite

java.lang.Object
  extended by junit.framework.TestSuite
      extended by org.apache.felix.ipojo.junit4osgi.OSGiTestSuite
All Implemented Interfaces:
junit.framework.Test

public class OSGiTestSuite
extends junit.framework.TestSuite

OSGi Test Suite. Allow the injection of the bundle context.

Author:
Felix Project Team

Field Summary
protected  BundleContext m_context
          The bundle context of the bundle containing the test suite.
 
Constructor Summary
OSGiTestSuite(BundleContext bc)
          Creates a OSGiTestSuite.
OSGiTestSuite(Class clazz, BundleContext bc)
          Creates a OSGiTestSuite.
OSGiTestSuite(Class clazz, String name, BundleContext bc)
          Creates a OSGiTestSuite.
OSGiTestSuite(String name, BundleContext bc)
          Creates a OSGiTestSuite.
 
Method Summary
 void addTestSuite(Class testClass)
          Adds the tests from the given class to the suite.
 void runTest(junit.framework.Test test, junit.framework.TestResult result)
          Executes the given Test with the given TestResult.
 void setBundleContext(BundleContext bc)
          Set the bundle context.
 
Methods inherited from class junit.framework.TestSuite
addTest, countTestCases, createTest, getName, getTestConstructor, run, setName, testAt, testCount, tests, toString, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_context

protected BundleContext m_context
The bundle context of the bundle containing the test suite.

Constructor Detail

OSGiTestSuite

public OSGiTestSuite(Class clazz,
                     BundleContext bc)
Creates a OSGiTestSuite.

Parameters:
clazz - the class
bc - the bundle context
See Also:
TestSuite.TestSuite(Class)

OSGiTestSuite

public OSGiTestSuite(BundleContext bc)
Creates a OSGiTestSuite.

Parameters:
bc - the bundle context
See Also:
TestSuite.TestSuite()

OSGiTestSuite

public OSGiTestSuite(String name,
                     BundleContext bc)
Creates a OSGiTestSuite.

Parameters:
name - the name
bc - the bundle context
See Also:
TestSuite.TestSuite(String)

OSGiTestSuite

public OSGiTestSuite(Class clazz,
                     String name,
                     BundleContext bc)
Creates a OSGiTestSuite.

Parameters:
clazz - the class
name - the name
bc - the bundle context
See Also:
TestSuite.TestSuite(Class, String)
Method Detail

setBundleContext

public void setBundleContext(BundleContext bc)
Set the bundle context.

Parameters:
bc - the bundle context to use.

addTestSuite

public void addTestSuite(Class testClass)
Adds the tests from the given class to the suite.

Overrides:
addTestSuite in class junit.framework.TestSuite
Parameters:
testClass - the class to add

runTest

public void runTest(junit.framework.Test test,
                    junit.framework.TestResult result)
Executes the given Test with the given TestResult.

Overrides:
runTest in class junit.framework.TestSuite
Parameters:
test - the test
result - the test result.
See Also:
TestSuite.runTest(junit.framework.Test, junit.framework.TestResult)


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.