ch.lambdaj.Lambda.having()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(547)

本文整理了Java中ch.lambdaj.Lambda.having()方法的一些代码示例,展示了Lambda.having()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.having()方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:having

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

  1. public void addDependantObservation(MRSObservation mrsObservation) {
  2. List<? extends MRSObservation> existingObservationList = Lambda.filter(having(on(CouchObservation.class).getConceptName(), is(equalTo(mrsObservation.getConceptName()))), dependantObservations);
  3. if (!existingObservationList.isEmpty()) {
  4. dependantObservations.remove(existingObservationList.get(0));
  5. }
  6. dependantObservations.add(convertObservationToCouchObservation(mrsObservation));
  7. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. public ManagedMongoDbLifecycleManager getStartedServer(int port) {
  2. return selectFirst(
  3. this.servers,
  4. having(on(ManagedMongoDbLifecycleManager.class).getPort(),
  5. is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(true))));
  6. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. private SelectiveMatcher findSelectiveMatcherByConnectionIdentifier(
  2. SelectiveMatcher[] selectiveMatchers) {
  3. return selectFirst(
  4. selectiveMatchers,
  5. having(on(SelectiveMatcher.class).identifier(),
  6. equalTo(identifier)).and(
  7. having(on(SelectiveMatcher.class).location(),
  8. notNullValue())));
  9. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. public ManagedMongoDbLifecycleManager getStoppedServer(int port) {
  2. return selectFirst(
  3. this.servers,
  4. having(on(ManagedMongoDbLifecycleManager.class).getPort(),
  5. is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false))));
  6. }

代码示例来源:origin: com.lordofthejars/nosqlunit-mongodb

  1. public ManagedMongoDbLifecycleManager getStoppedServer(int port) {
  2. return selectFirst(
  3. this.servers,
  4. having(on(ManagedMongoDbLifecycleManager.class).getPort(),
  5. is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false))));
  6. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. @Override
  2. public boolean matches(Object matchee) {
  3. TestOutcome testOutcome = (TestOutcome) matchee;
  4. return exists(testOutcome.getTags(), having(on(TestTag.class), is(expectedTag)));
  5. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. public List<Screenshot> getScreenshots() {
  2. List<Screenshot> screenshots = new ArrayList<Screenshot>();
  3. List<TestStep> testStepsWithScreenshots = select(getFlattenedTestSteps(),
  4. having(on(TestStep.class).needsScreenshots()));
  5. for (TestStep currentStep : testStepsWithScreenshots) {
  6. screenshots.addAll(screenshotsIn(currentStep));
  7. }
  8. return ImmutableList.copyOf(screenshots);
  9. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. private List<TestOutcome> outcomesForRelease(List<? extends TestOutcome> outcomes,
  2. String releaseName) {
  3. releaseManager.enrichOutcomesWithReleaseTags(outcomes);
  4. return (List<TestOutcome>) filter(having(on(TestOutcome.class).getVersions(), hasItem(releaseName)), outcomes);
  5. }
  6. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. public ManagedRedisLifecycleManager getStoppedServer(int port) {
  2. if(this.master.getPort() == port && !this.master.isReady()) {
  3. return this.master;
  4. }
  5. return selectFirst(
  6. this.slaveServers,
  7. having(on(ManagedRedisLifecycleManager.class).getPort(),
  8. is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false))));
  9. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. public ManagedRedisLifecycleManager getStartedServer(int port) {
  2. if(this.master.getPort() == port && this.master.isReady()) {
  3. return this.master;
  4. }
  5. return selectFirst(
  6. this.slaveServers,
  7. having(on(ManagedRedisLifecycleManager.class).getPort(),
  8. is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true))));
  9. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. @Override
  2. public boolean matches(Object matchee) {
  3. TestOutcome testOutcome = (TestOutcome) matchee;
  4. return exists(testOutcome.getTags(), having(on(TestTag.class).getType(), is(tagType)));
  5. }

代码示例来源:origin: com.lordofthejars/nosqlunit-redis

  1. public ManagedRedisLifecycleManager getStartedServer(int port) {
  2. if(this.master.getPort() == port && this.master.isReady()) {
  3. return this.master;
  4. }
  5. return selectFirst(
  6. this.slaveServers,
  7. having(on(ManagedRedisLifecycleManager.class).getPort(),
  8. is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true))));
  9. }

代码示例来源:origin: org.motechproject/motech-alerts-api

  1. @Override
  2. public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) {
  3. return Lambda.filter(having(on(Alert.class).getAlertType(), equalTo(alertCriteria.alertType())), alerts);
  4. }
  5. },

代码示例来源:origin: com.lordofthejars/nosqlunit-redis

  1. public ManagedRedisLifecycleManager getStoppedServer(int port) {
  2. if(this.master.getPort() == port && !this.master.isReady()) {
  3. return this.master;
  4. }
  5. return selectFirst(
  6. this.slaveServers,
  7. having(on(ManagedRedisLifecycleManager.class).getPort(),
  8. is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false))));
  9. }

代码示例来源:origin: org.motechproject/motech-alerts-api

  1. @Override
  2. public List<Alert> filter(List<Alert> alerts, AlertCriteria alertCriteria) {
  3. return Lambda.filter(having(on(Alert.class).getStatus(), equalTo(alertCriteria.alertStatus())), alerts);
  4. }
  5. },

代码示例来源:origin: net.serenity-bdd/core

  1. private int countDataRowsWithResult(TestResult expectedResult) {
  2. List<DataTableRow> matchingRows
  3. = filter(having(on(DataTableRow.class).getResult(), is(expectedResult)), getDataTable().getRows());
  4. return matchingRows.size();
  5. }

代码示例来源:origin: lordofthejars/nosql-unit

  1. private static ColumnFamilyDefinition checkColumnFamilyName(List<ColumnFamilyDefinition> columnFamilyDefinitions,
  2. ColumnFamilyModel expectedColumnFamilyModel) throws Error {
  3. ColumnFamilyDefinition columnFamily = selectUnique(columnFamilyDefinitions,
  4. having(on(ColumnFamilyDefinition.class).getName(), equalTo(expectedColumnFamilyModel.getName())));
  5. if (columnFamily == null) {
  6. throw FailureHandler.createFailure("Expected name of column family is %s but was not found.",
  7. expectedColumnFamilyModel.getName());
  8. }
  9. return columnFamily;
  10. }

代码示例来源:origin: net.serenity-bdd/core

  1. @Override
  2. public boolean matches(Object matchee) {
  3. TestOutcome testOutcome = (TestOutcome) matchee;
  4. return exists(testOutcome.getTags(), having(on(TestTag.class).getName(), equalToIgnoringCase(tagName)));
  5. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. @Override
  2. public boolean matches(Object matchee) {
  3. TestOutcome testOutcome = (TestOutcome) matchee;
  4. return exists(testOutcome.getTags(), having(on(TestTag.class).getName(), equalToIgnoringCase(tagName)));
  5. }

代码示例来源:origin: net.thucydides/thucydides-core

  1. public List<ScreenshotAndHtmlSource> getScreenshotAndHtmlSources() {
  2. List<TestStep> testStepsWithScreenshots = select(getFlattenedTestSteps(),
  3. having(on(TestStep.class).needsScreenshots()));
  4. return flatten(extract(testStepsWithScreenshots, on(TestStep.class).getScreenshots()));
  5. }

相关文章