当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
MockServices (NB JUnit) - NetBeans API Javadoc (Current Development Version)
org.netbeans.junit
Class MockServices
java.lang.Object
org.netbeans.junit.MockServices
public class MockServices
- extends Object
Lets you register mock implementations of global services.
You might for example do this in TestCase.setUp()
.
If you need to register individual instances, and are using the Lookup
framework, try org.openide.util.test.MockLookup
.
- Since:
- org.netbeans.modules.nbjunit/1 1.30
- See Also:
Lookup
,
ServiceLoader
Method Summary |
static void |
setServices(Class<?>... services)
Set (or reset) the set of mock services. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
setServices
public static void setServices(Class<?>... services)
throws IllegalArgumentException
- Set (or reset) the set of mock services.
Clears any previous registration.
After this call,
Lookup
and ServiceLoader
should both
"see" the newly registered classes.
(Other classes really registered in META-INF/services/
will
also be available, but after the ones you have registered.)
Each class must be public and concrete with a public no-arg constructor.
- Parameters:
services
- a set of service classes to register
- Throws:
IllegalArgumentException
- if some classes are not instantiable as beans