本文整理了Java中ch.lambdaj.Lambda.having()
方法的一些代码示例,展示了Lambda.having()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.having()
方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:having
[英]Creates an hamcrest matcher that is evalued to true accordingly to the value of the passed argument
[中]创建一个hamcrest匹配器,该匹配器根据传递参数的值被赋值为true
代码示例来源:origin: org.motechproject/motech-mrs-couchdb
public void addDependantObservation(MRSObservation mrsObservation) {
List<? extends MRSObservation> existingObservationList = Lambda.filter(having(on(CouchObservation.class).getConceptName(), is(equalTo(mrsObservation.getConceptName()))), dependantObservations);
if (!existingObservationList.isEmpty()) {
dependantObservations.remove(existingObservationList.get(0));
}
dependantObservations.add(convertObservationToCouchObservation(mrsObservation));
}
代码示例来源:origin: lordofthejars/nosql-unit
public ManagedMongoDbLifecycleManager getStartedServer(int port) {
return selectFirst(
this.servers,
having(on(ManagedMongoDbLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(true))));
}
代码示例来源:origin: lordofthejars/nosql-unit
private SelectiveMatcher findSelectiveMatcherByConnectionIdentifier(
SelectiveMatcher[] selectiveMatchers) {
return selectFirst(
selectiveMatchers,
having(on(SelectiveMatcher.class).identifier(),
equalTo(identifier)).and(
having(on(SelectiveMatcher.class).location(),
notNullValue())));
}
代码示例来源:origin: lordofthejars/nosql-unit
public ManagedMongoDbLifecycleManager getStoppedServer(int port) {
return selectFirst(
this.servers,
having(on(ManagedMongoDbLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false))));
}
代码示例来源:origin: com.lordofthejars/nosqlunit-mongodb
public ManagedMongoDbLifecycleManager getStoppedServer(int port) {
return selectFirst(
this.servers,
having(on(ManagedMongoDbLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false))));
}
代码示例来源:origin: net.thucydides/thucydides-core
@Override
public boolean matches(Object matchee) {
TestOutcome testOutcome = (TestOutcome) matchee;
return exists(testOutcome.getTags(), having(on(TestTag.class), is(expectedTag)));
}
代码示例来源:origin: net.thucydides/thucydides-core
public List<Screenshot> getScreenshots() {
List<Screenshot> screenshots = new ArrayList<Screenshot>();
List<TestStep> testStepsWithScreenshots = select(getFlattenedTestSteps(),
having(on(TestStep.class).needsScreenshots()));
for (TestStep currentStep : testStepsWithScreenshots) {
screenshots.addAll(screenshotsIn(currentStep));
}
return ImmutableList.copyOf(screenshots);
}
代码示例来源:origin: net.thucydides/thucydides-core
private List<TestOutcome> outcomesForRelease(List<? extends TestOutcome> outcomes,
String releaseName) {
releaseManager.enrichOutcomesWithReleaseTags(outcomes);
return (List<TestOutcome>) filter(having(on(TestOutcome.class).getVersions(), hasItem(releaseName)), outcomes);
}
}
代码示例来源:origin: lordofthejars/nosql-unit
public ManagedRedisLifecycleManager getStoppedServer(int port) {
if(this.master.getPort() == port && !this.master.isReady()) {
return this.master;
}
return selectFirst(
this.slaveServers,
having(on(ManagedRedisLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false))));
}
代码示例来源:origin: lordofthejars/nosql-unit
public ManagedRedisLifecycleManager getStartedServer(int port) {
if(this.master.getPort() == port && this.master.isReady()) {
return this.master;
}
return selectFirst(
this.slaveServers,
having(on(ManagedRedisLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true))));
}
代码示例来源:origin: net.thucydides/thucydides-core
@Override
public boolean matches(Object matchee) {
TestOutcome testOutcome = (TestOutcome) matchee;
return exists(testOutcome.getTags(), having(on(TestTag.class).getType(), is(tagType)));
}
代码示例来源:origin: com.lordofthejars/nosqlunit-redis
public ManagedRedisLifecycleManager getStartedServer(int port) {
if(this.master.getPort() == port && this.master.isReady()) {
return this.master;
}
return selectFirst(
this.slaveServers,
having(on(ManagedRedisLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true))));
}
代码示例来源:origin: org.motechproject/motech-alerts-api
@Override
public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) {
return Lambda.filter(having(on(Alert.class).getAlertType(), equalTo(alertCriteria.alertType())), alerts);
}
},
代码示例来源:origin: com.lordofthejars/nosqlunit-redis
public ManagedRedisLifecycleManager getStoppedServer(int port) {
if(this.master.getPort() == port && !this.master.isReady()) {
return this.master;
}
return selectFirst(
this.slaveServers,
having(on(ManagedRedisLifecycleManager.class).getPort(),
is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false))));
}
代码示例来源:origin: org.motechproject/motech-alerts-api
@Override
public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) {
return Lambda.filter(having(on(Alert.class).getStatus(), equalTo(alertCriteria.alertStatus())), alerts);
}
},
代码示例来源:origin: net.serenity-bdd/core
private int countDataRowsWithResult(TestResult expectedResult) {
List<DataTableRow> matchingRows
= filter(having(on(DataTableRow.class).getResult(), is(expectedResult)), getDataTable().getRows());
return matchingRows.size();
}
代码示例来源:origin: lordofthejars/nosql-unit
private static ColumnFamilyDefinition checkColumnFamilyName(List<ColumnFamilyDefinition> columnFamilyDefinitions,
ColumnFamilyModel expectedColumnFamilyModel) throws Error {
ColumnFamilyDefinition columnFamily = selectUnique(columnFamilyDefinitions,
having(on(ColumnFamilyDefinition.class).getName(), equalTo(expectedColumnFamilyModel.getName())));
if (columnFamily == null) {
throw FailureHandler.createFailure("Expected name of column family is %s but was not found.",
expectedColumnFamilyModel.getName());
}
return columnFamily;
}
代码示例来源:origin: net.serenity-bdd/core
@Override
public boolean matches(Object matchee) {
TestOutcome testOutcome = (TestOutcome) matchee;
return exists(testOutcome.getTags(), having(on(TestTag.class).getName(), equalToIgnoringCase(tagName)));
}
代码示例来源:origin: net.thucydides/thucydides-core
@Override
public boolean matches(Object matchee) {
TestOutcome testOutcome = (TestOutcome) matchee;
return exists(testOutcome.getTags(), having(on(TestTag.class).getName(), equalToIgnoringCase(tagName)));
}
代码示例来源:origin: net.thucydides/thucydides-core
public List<ScreenshotAndHtmlSource> getScreenshotAndHtmlSources() {
List<TestStep> testStepsWithScreenshots = select(getFlattenedTestSteps(),
having(on(TestStep.class).needsScreenshots()));
return flatten(extract(testStepsWithScreenshots, on(TestStep.class).getScreenshots()));
}
内容来源于网络,如有侵权,请联系作者删除!