本文整理匯總了Java中org.jmock.lib.legacy.ClassImposteriser類的典型用法代碼示例。如果您正苦於以下問題:Java ClassImposteriser類的具體用法?Java ClassImposteriser怎麽用?Java ClassImposteriser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ClassImposteriser類屬於org.jmock.lib.legacy包,在下文中一共展示了ClassImposteriser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
m = new Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
myInfo = m.mock(PowerShellInfo.class);
final PowerShellEdition edition = SystemInfo.isWindows ? PowerShellEdition.DESKTOP : PowerShellEdition.CORE;
m.checking(new Expectations() {{
allowing(myInfo).getEdition();
will(returnValue(edition));
}});
myProvider = new PowerShellCommandLineProvider();
myScriptsRootDir = createTempDir();
myScriptFile = new File(myScriptsRootDir, SCRIPT_FILE_NAME);
myScriptFile.createNewFile();
super.registerAsTempFile(myScriptFile);
}
示例2: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
m = new Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
myTempDir = createTempDir();
myCheckoutDir = createTempDir();
myGenerator = new ScriptGenerator();
}
示例3: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void setUp() throws Exception
{
mockery = new Mockery();
mockery.setImposteriser(ClassImposteriser.INSTANCE);
transport = mockery.mock(Transport.class);
byteChannelReader = mockery.mock(ByteChannelReader.class);
outboundMessageHandler = mockery.mock(OutboundMessageHandler.class);
writableByteChannel = mockery.mock(WritableByteChannel.class);
readableByteChannel = mockery.mock(ReadableByteChannel.class);
mockery.checking(new Expectations()
{
{
ignoring(writableByteChannel);
}
});
}
示例4: before
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void before() {
context = new JUnit4Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
authorParser = context.mock(AuthorParser.class);
contentParser = context.mock(ContentParser.class);
dataParser = context.mock(DataParser.class);
fieldParser = context.mock(FieldParser.class);
summaryParser = context.mock(SummaryParser.class);
titleParser = context.mock(TitleParser.class);
updatedParser = context.mock(UpdatedParser.class);
entryParser = new EntryParserImpl(authorParser, contentParser, dataParser,
fieldParser, summaryParser, titleParser,
updatedParser);
try {
document = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
} catch (ParserConfigurationException e) {
fail("Failure to create test document");
}
}
示例5: before
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void before() throws MalformedURLException {
context = new JUnit4Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
linkConverter = context.mock(AbsoluteLinkConverter.class);
appendableFactory = context.mock(AppendableFactory.class);
attachmentDownloader = new FakeDownloader();
entryStore = context.mock(EntryStore.class);
entryStoreFactory = context.mock(EntryStoreFactory.class);
feedProvider = context.mock(FeedProvider.class);
pageExporter = context.mock(PageExporter.class);
progressListener = context.mock(ProgressListener.class);
revisionsExporter = context.mock(RevisionsExporter.class);
siteExporter = new SiteExporterImpl(linkConverter, appendableFactory,
attachmentDownloader, entryStoreFactory, feedProvider, pageExporter,
revisionsExporter);
sitesService = new SitesService("");
entries = Sets.newHashSet();
feedUrl = new URL("https://host/feeds/content/domain/webspace");
}
示例6: before
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void before() throws Exception {
_mock = new JUnit4Mockery() {
{
setThreadingPolicy(new Synchroniser());
setImposteriser(ClassImposteriser.INSTANCE);
}
};
_searchService = _mock.mock(SearchService.class);
_repository = _mock.mock(Repository.class);
_nodeService = _mock.mock(NodeService.class);
_clusterProbeUtils = new ClusterProbeUtils();
_clusterProbeUtils.setSearchService(_searchService);
_clusterProbeUtils.setRepository(_repository);
_clusterProbeUtils.setNodeService(_nodeService);
}
示例7: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void setUp() {
myMockery = new JUnit4Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
myDocument = myMockery.mock(DocumentImpl.class);
myMockery.checking(new Expectations() {{
allowing(myDocument).getTextLength(); will(new CustomAction("getTextLength") {
@Override
public Object invoke(Invocation invocation) throws Throwable {
return myArray.length();
}
});
}});
init(10);
if (myConfig != null) {
myArray.insert(myConfig.text(), 0);
myArray.setDeferredChangeMode(myConfig.deferred());
}
}
示例8: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
public void setUp() throws Exception {
super.setUp();
setImposteriser(ClassImposteriser.INSTANCE);
RhnBaseTestCase.disableLocalizationServiceLogging();
final List dataList = CSVWriterTest.getTestListOfMaps();
req = mock(HttpServletRequest.class);
pageContext = mock(PageContext.class);
webSess = mock(WebSession.class);
writer = new RhnMockJspWriter();
context().checking(new Expectations() { {
atLeast(1).of(pageContext).getAttribute(listName);
will(returnValue(dataList));
atLeast(1).of(pageContext).getRequest();
will(returnValue(req));
} });
lt = new ListTag();
lt.setName("testIsMyName");
lst = new ListSetTag();
lt.setPageContext(pageContext);
lt.setParent(lst);
lt.setDataset(listName);
}
示例9: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
public void setUp() throws Exception {
super.setUp();
setImposteriser(ClassImposteriser.INSTANCE);
RhnBaseTestCase.disableLocalizationServiceLogging();
request = mock(HttpServletRequest.class);
response = mock(HttpServletResponse.class);
pageContext = mock(PageContext.class);
writer = new RhnMockJspWriter();
ldt = new ListDisplayTag();
lt = new ListTag();
ldt.setPageContext(pageContext);
ldt.setParent(lt);
lt.setPageList(new DataResult(CSVWriterTest.getTestListOfMaps()));
context().checking(new Expectations() { {
atLeast(1).of(pageContext).getOut();
will(returnValue(writer));
atLeast(1).of(pageContext).getRequest();
will(returnValue(request));
atLeast(1).of(pageContext).setAttribute("current", null);
} });
}
示例10: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
public void setUp() throws Exception {
super.setUp();
setImposteriser(ClassImposteriser.INSTANCE);
RhnBaseTestCase.disableLocalizationServiceLogging();
request = mock(HttpServletRequest.class);
response = mock(HttpServletResponse.class);
context = mock(PageContext.class);
writer = new RhnMockJspWriter();
ldt = new UnpagedListDisplayTag();
lt = new ListTag();
ldt.setPageContext(context);
ldt.setParent(lt);
lt.setPageList(new DataResult(CSVWriterTest.getTestListOfMaps()));
context().checking(new Expectations() { {
atLeast(1).of(context).getOut();
will(returnValue(writer));
atLeast(1).of(context).getRequest();
will(returnValue(request));
atLeast(1).of(context).setAttribute("current", null);
} });
}
示例11: assertMaps
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
private void assertMaps(final String str, StageResult value) throws SQLException {
final ResultGetter resultGetter;
Mockery context = new Mockery() {
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
resultGetter = context.mock(ResultGetter.class);
context.checking(new Expectations() {
{
one(resultGetter).getString();
will(returnValue(str));
}
});
StageResult result = (StageResult) callback.getResult(resultGetter);
assertThat(result, is(equal(value)));
final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
context.checking(new Expectations() {
{
one(parameterSetter).setString(str);
}
});
callback.setParameter(parameterSetter, value);
}
示例12: assertMaps
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
private void assertMaps(final String str, StageState value) throws SQLException {
final ResultGetter resultGetter;
Mockery context = new Mockery() {
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
resultGetter = context.mock(ResultGetter.class);
context.checking(new Expectations() {
{
one(resultGetter).getString();
will(returnValue(str));
}
});
StageState result = (StageState) callback.getResult(resultGetter);
assertThat(result, is(equal(value)));
final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
context.checking(new Expectations() {
{
one(parameterSetter).setString(str);
}
});
callback.setParameter(parameterSetter, value);
}
示例13: testUseMockObjectHangs1
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@SuppressWarnings({"cast", "unchecked"})
public void testUseMockObjectHangs1() {
Mockery context = new Mockery();
context.setImposteriser(ClassImposteriser.INSTANCE);
final Vector<Object> mock = (Vector<Object>)context.mock(Vector.class);
context.checking(new Expectations() {{
atLeast(1).of (mock).size(); will(returnValue(2));
}});
try {
for (int i = 0; i < mock.size(); i++) {
System.out.println("Vector entry " + i + " = " + mock.get(i));
}
}
catch (ExpectationError error) {
// expected
}
}
開發者ID:Shared-Business-Service,項目名稱:jMock-Demo,代碼行數:20,代碼來源:RedeclaredObjectMethodsAcceptanceTests.java
示例14: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void setUp() {
parentElement.setVisibility(Visibility.VISIBLE);
parentElement.setPreferredContentWidth(PARENT_WIDTH);
parentElement.setPreferredContentHeight(PARENT_HEIGHT);
uiElement.setVisibility(Visibility.VISIBLE);
uiElement.setPreferredContentWidth(ELEMENT_WIDTH);
uiElement.setPreferredContentHeight(ELEMENT_HEIGHT);
parentRenderNode.addChild(renderNode);
mockery = new Mockery();
mockery.setImposteriser(ClassImposteriser.INSTANCE);
layoutState = mockery.mock(LayoutState.class);
renderTree = mockery.mock(UiContainerRenderTree.class);
}
示例15: setUp
import org.jmock.lib.legacy.ClassImposteriser; //導入依賴的package包/類
@Before
public void setUp() {
mockery = new Mockery();
mockery.setImposteriser(ClassImposteriser.INSTANCE);
theme = mockery.mock(UiTheme.class);
renderTree = mockery.mock(UiContainerRenderTree.class);
column.setHorizontalLayout("xs-3c");
column.setVisibility(Visibility.VISIBLE);
row1.setVisibility(Visibility.VISIBLE);
row2.setVisibility(Visibility.VISIBLE);
rowRenderNode1.addChild(renderNode1);
rowRenderNode1.addChild(renderNode2);
rowRenderNode2.addChild(renderNode1);
rowRenderNode2.addChild(renderNode2);
columnRenderNode.addChild(rowRenderNode1);
columnRenderNode.addChild(rowRenderNode2);
}