public class MockServices extends Object
TestCase.setUp()
.
If you need to register individual instances, and are using the Lookup
framework, try org.openide.util.test.MockLookup
.
Lookup
,
ServiceLoader
Modifier and Type | Method and Description |
---|---|
static void |
setServices(Class<?>... services)
Set (or reset) the set of mock services.
|
public static void setServices(Class<?>... services) throws IllegalArgumentException
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.services
- a set of service classes to registerIllegalArgumentException
- if some classes are not instantiable as beans