Package org.glassfish.tests.utils.mock
Class MockGenerator
java.lang.Object
org.glassfish.tests.utils.mock.MockGenerator
Generates some objects useful for tests, but not simply available in the test context.
- Author:
- David Matejcek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a newSubjectinstance holding two principals: asadmin _InternalSystemAdministrator_<T> org.glassfish.hk2.utilities.AbstractActiveDescriptor<T>createMockDescriptor(Class<T> iface) Creates a mock implementation for the given interface and a descriptor for it.<T> TcreateMockThrowingExceptions(Class<T> clazz) Creates a mock implementation for the given interface.
-
Constructor Details
-
MockGenerator
public MockGenerator()
-
-
Method Details
-
createAsadminSubject
Creates a newSubjectinstance holding two principals:- asadmin
- _InternalSystemAdministrator_
- Returns:
- new
Subjectinstance
-
createMockDescriptor
public <T> org.glassfish.hk2.utilities.AbstractActiveDescriptor<T> createMockDescriptor(Class<T> iface) Creates a mock implementation for the given interface and a descriptor for it. Every method of the mock will throwUnsupportedOperationException, but it can be useful in cases where we need a mandatory dependency which is unused in real time. The descriptor has maximal ranking and is reified.- Type Parameters:
T- Requested API of the generated class.- Parameters:
iface-- Returns:
- generated descriptor of the proxy.
-
createMockThrowingExceptions
Creates a mock implementation for the given interface. Every method of the mock will throwUnsupportedOperationException- Type Parameters:
T-- Parameters:
clazz-- Returns:
- the implementation
-