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

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

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

Lambda.on介绍

[英]Constructs a proxy object that mocks the given Class registering all the subsequent invocations on the object.
[中]构造一个代理对象,该对象模拟给定类,并注册该对象上的所有后续调用。

代码示例

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

/**
 * @return The list of all of the different tag types that appear in the test outcomes.
 */
public List<String> getTagTypes() {
  Set<String> tagTypes = Sets.newHashSet();
  for (TestOutcome outcome : outcomes) {
    addTagTypesFrom(outcome, tagTypes);
  }
  return sort(ImmutableList.copyOf(tagTypes), on(String.class));
}

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

public Long getDuration() {
  if ((duration == 0) && (testSteps.size() > 0)) {
    return sum(testSteps, on(TestStep.class).getDuration());
  } else {
    return duration;
  }
}

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

/**
 * @return The list of all the tags associated with a given tag type.
 */
public List<TestTag> getTagsOfType(String tagType) {
  Set<TestTag> tags = Sets.newHashSet();
  for (TestOutcome outcome : outcomes) {
    tags.addAll(tagsOfType(tagType).in(outcome));
  }
  return sort(ImmutableList.copyOf(tags), on(String.class));
}

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

private static List<byte[]> extractSortValues(JSONArray expectedValuesArray) {
  Set<SortElement> elementsOrderedByScore = new TreeSet<RedisAssertion.SortElement>();
  for (Object expectedObject : expectedValuesArray) {
    JSONObject expectedValue = (JSONObject) expectedObject;
    elementsOrderedByScore.add(new SortElement((java.lang.Number) expectedValue.get(SCORE_TOKEN),
        toByteArray(expectedValue.get(VALUE_TOKEN))));
  }
  return extract(elementsOrderedByScore, on(SortElement.class).getValue());
}

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

/**
 * @return The list of TestOutcomes contained in this test outcome set.
 */
public List<? extends TestOutcome> getTests() {
  return sort(outcomes, on(TestOutcome.class).getTitle());
}

代码示例来源: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: net.thucydides/thucydides-core

/**
 * @return The total number of nested steps in these test outcomes.
 */
public int getStepCount() {
  return sum(extract(outcomes, on(TestOutcome.class).getNestedStepCount())).intValue();
}

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

public double getOverallStability() {
  if (outcomes.isEmpty()) {
    return 0.0;
  } else {
    return sum(outcomes, on(TestOutcome.class).getOverallStability()) / getTestCount();
  }
}

代码示例来源: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: 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: net.thucydides/thucydides-core

public List<TestTag> getTagsOfTypeExcluding(String tagType, String excludedTag) {
  Set<TestTag> tags = Sets.newHashSet();
  for (TestOutcome outcome : outcomes) {
    List<TestTag> allTagsOfType = removeGeneralTagsFrom(tagsOfType(tagType).in(outcome));
    allTagsOfType = removeExcluded(allTagsOfType, excludedTag);
    tags.addAll(allTagsOfType);
  }
  return sort(ImmutableList.copyOf(tags), on(String.class));
}

代码示例来源: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: net.serenity-bdd/core

private int countStepsWithResult(TestResult expectedResult, TestType testType) {
  int stepCount = sum(outcomes, on(TestOutcome.class).countNestedStepsWithResult(expectedResult, testType));
  if ((stepCount == 0) && aMatchingTestExists(expectedResult, testType)) {
    return (int) Math.round(getAverageTestSize());
  }
  return stepCount;
}

代码示例来源: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 String toString() {
  if (!hasChildren()) {
    return description;
  } else {
    String childDescriptions = join(extract(children, on(TestStep.class).toString()));
    return description + " [" + childDescriptions + "]";
  }
}

代码示例来源: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)));
}

相关文章