站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

MockServices (NB JUnit) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.nbjunit/1 1.41

org.netbeans.junit
Class MockServices

java.lang.Object
  extended by 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
 

Method Detail

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

org.netbeans.modules.nbjunit/1 1.41

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.