本文整理了Java中org.easymock.EasyMock.getCurrentArguments()
方法的一些代码示例,展示了EasyMock.getCurrentArguments()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EasyMock.getCurrentArguments()
方法的具体详情如下:
包路径:org.easymock.EasyMock
类名称:EasyMock
方法名:getCurrentArguments
[英]Returns the arguments of the current mock method call, if inside an IAnswer
callback - be careful here, reordering parameters of method changes the semantics of your tests.
[中]如果在IAnswer
回调中,则返回当前模拟方法调用的参数-这里要小心,对方法的参数重新排序会更改测试的语义。
代码示例来源:origin: apache/shiro
public Object answer() throws Throwable {
return getCurrentArguments()[0];
}
});
代码示例来源:origin: googleapis/google-cloud-java
@Override
public Integer answer() throws Throwable {
// Modify the argument to match the expected behavior of `read`.
((ByteBuffer) getCurrentArguments()[0]).put(expected);
return 2;
}
});
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Order answer() throws Throwable {
Order order = (Order) EasyMock.getCurrentArguments()[0];
order.getFulfillmentGroups().get(0).getFulfillmentGroupItems().addAll(order.getFulfillmentGroups().get(1).getFulfillmentGroupItems());
order.getFulfillmentGroups().remove(order.getFulfillmentGroups().get(1));
return order;
}
}).anyTimes();
代码示例来源:origin: geoserver/geoserver
@Override
public Void answer() throws Throwable {
Object[] args = getCurrentArguments();
InputStream is = (InputStream) args[1];
byte[] input = IOUtils.toByteArray(is);
SLDParser parser =
new SLDParser(CommonFactoryFinder.getStyleFactory());
parser.setInput(new ByteArrayInputStream(input));
StyledLayerDescriptor sld = parser.parseSLD();
NamedLayer nl = (NamedLayer) sld.getStyledLayers()[0];
assertEquals("foo", nl.getName());
Style style = nl.getStyles()[0];
assertEquals(
"A raster style",
style.getDescription().getTitle().toString());
assertEquals(1, style.featureTypeStyles().size());
FeatureTypeStyle fts = style.featureTypeStyles().get(0);
assertEquals(1, fts.rules().size());
assertThat(
fts.rules().get(0).symbolizers().get(0),
instanceOf(RasterSymbolizer.class));
// make sure it's valid
SLDValidator validator = new SLDValidator();
List errors =
validator.validateSLD(new ByteArrayInputStream(input));
assertEquals(0, errors.size());
return null;
}
});
代码示例来源:origin: geoserver/geoserver
@Override
public Void answer() throws Throwable {
Object[] args = getCurrentArguments();
InputStream is = (InputStream) args[1];
byte[] input = IOUtils.toByteArray(is);
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public Boolean answer() {
Object[] args = EasyMock.getCurrentArguments();
return systemConf.getBoolean((Property) args[0]);
}
}).anyTimes();
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public Boolean answer() throws Throwable {
return getCurrentArguments()[0].equals("foo");
}
}).times(2);
代码示例来源:origin: iipc/openwayback
@Override
public String answer() throws Throwable {
String name = (String)EasyMock.getCurrentArguments()[0];
String[] va = parameterMap.get(name);
return va != null ? va[0] : null;
}
});
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@SuppressWarnings("unchecked")
public FeatureRegistry.LookupResult answer() throws Throwable {
List<String> unsupported = (List<String>)getCurrentArguments()[2];
unsupported.add("foo");
return lr2;
}
});
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@SuppressWarnings("unchecked")
public List<FeatureResource> answer() throws Throwable {
List<String> unsupported = (List<String>)getCurrentArguments()[2];
unsupported.add("foo");
return Lists.newArrayList();
}
});
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@SuppressWarnings("unchecked")
public Void answer() throws Throwable {
Map<String, Object> config = (Map<String, Object>)getCurrentArguments()[0];
String f3Value = (String)config.get("feature3");
config.put("feature3", f3Value + ":MODIFIED");
return null;
}
});
代码示例来源:origin: j256/ormlite-core
@Override
public Integer answer() throws Throwable {
GeneratedKeyHolder keyHolder = (GeneratedKeyHolder) (getCurrentArguments()[3]);
keyHolder.addKey(2);
return 1;
}
});
代码示例来源:origin: hibernate/hibernate-search
private IAnswer<Void> nonBulkableAggregateAnswer(ElasticsearchWork<?> mock) {
return () -> {
ElasticsearchWorkAggregator aggregator = (ElasticsearchWorkAggregator) getCurrentArguments()[0];
aggregator.addNonBulkable( mock );
return null;
};
}
代码示例来源:origin: hibernate/hibernate-search
private IAnswer<Void> nonBulkableAggregateAnswer(ElasticsearchWork<?> mock) {
return () -> {
ElasticsearchWorkAggregator aggregator = (ElasticsearchWorkAggregator) getCurrentArguments()[0];
aggregator.addNonBulkable( mock );
return null;
};
}
代码示例来源:origin: hibernate/hibernate-search
private IAnswer<Void> bulkableAggregateAnswer(BulkableElasticsearchWork<?> mock) {
return () -> {
ElasticsearchWorkAggregator aggregator = (ElasticsearchWorkAggregator) getCurrentArguments()[0];
aggregator.addBulkable( mock );
return null;
};
}
}
代码示例来源:origin: j256/ormlite-core
@Override
public Integer answer() throws Throwable {
GeneratedKeyHolder holder = (GeneratedKeyHolder) getCurrentArguments()[3];
holder.addKey((Integer) 0);
return 1;
}
});
代码示例来源:origin: hibernate/hibernate-search
private IAnswer<Void> bulkableAggregateAnswer(BulkableElasticsearchWork<?> mock) {
return () -> {
ElasticsearchWorkAggregator aggregator = (ElasticsearchWorkAggregator) getCurrentArguments()[0];
aggregator.addBulkable( mock );
return null;
};
}
}
代码示例来源:origin: iipc/openwayback
@Override
public Boolean answer() throws Throwable {
CDXLine line = (CDXLine)EasyMock.getCurrentArguments()[0];
assertEquals(url, line.getOriginalUrl());
assertEquals(urlkey, line.getUrlKey());
return true;
}
});
代码示例来源:origin: j256/ormlite-core
@Override
public Integer answer() throws Throwable {
GeneratedKeyHolder holder = (GeneratedKeyHolder) getCurrentArguments()[3];
holder.addKey((Integer) 1);
holder.addKey((Integer) 2);
return 1;
}
});
代码示例来源:origin: GeoWebCache/geowebcache
public Boolean answer() throws Throwable {
TileObject tile =
(TileObject) EasyMock.getCurrentArguments()[0];
if (puts.contains(TransientCache.computeTransientKey(tile))) {
tile.setBlob(new ByteArrayResource(fakeWMSResponse));
storageGetCounter.incrementAndGet();
return true;
} else {
return false;
}
}
})
内容来源于网络,如有侵权,请联系作者删除!