org.assertj.core.api.WritableAssertionInfo.description()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(65)

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

WritableAssertionInfo.description介绍

暂无

代码示例

代码示例来源:origin: org.assertj/assertj-core

/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF describedAs(String description, Object... args) {
 info.description(description, args);
 return myself;
}

代码示例来源:origin: org.assertj/assertj-core

/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF describedAs(Description description) {
 info.description(description);
 return myself;
}

代码示例来源:origin: joel-costigliola/assertj-core

/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF describedAs(Description description) {
 info.description(description);
 return myself;
}

代码示例来源:origin: joel-costigliola/assertj-core

/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF describedAs(String description, Object... args) {
 info.description(description, args);
 return myself;
}

代码示例来源:origin: joel-costigliola/assertj-core

private AssertionError multipleAssertionsError(List<AssertionError> assertionErrors) {
 // we don't allow overriding the error message to avoid loosing all the failed assertions error message.
 return assertionErrorCreator.multipleAssertionsError(info.description(), assertionErrors);
}

代码示例来源:origin: org.assertj/assertj-core

private void propagateAssertionInfoFrom(AbstractAssert<?, ?> assertInstance) {
 this.info.useRepresentation(assertInstance.info.representation());
 this.info.description(assertInstance.info.description());
 this.info.overridingErrorMessage(assertInstance.info.overridingErrorMessage());
}

代码示例来源:origin: joel-costigliola/assertj-core

private void propagateAssertionInfoFrom(AbstractAssert<?, ?> assertInstance) {
 this.info.useRepresentation(assertInstance.info.representation());
 this.info.description(assertInstance.info.description());
 this.info.overridingErrorMessage(assertInstance.info.overridingErrorMessage());
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Uses the given {@link Function}s to extract the values from the object under test into a list, this new list becoming
 * the object under test.
 * <p>
 * If the given {@link Function}s extract the id, name and email values then the list will contain the id, name and email values
 * of the object under test, you can then perform list assertions on the extracted values.
 * <p>
 * Example:
 * <pre><code class='java'> // Create frodo, setting its name, age and Race (Race having a name property)
 * TolkienCharacter frodo = new TolkienCharacter(&quot;Frodo&quot;, 33, HOBBIT);
 *
 * // let's verify Frodo's name, age and race name:
 * assertThat(frodo).extracting(TolkienCharacter::getName,
 *                              character -&gt; character.age, // public field
 *                              character -&gt; character.getRace().getName())
 *                  .containsExactly(&quot;Frodo&quot;, 33, "Hobbit");</code></pre>
 * <p>
 * Note that the order of extracted values is consistent with the order of given extractor functions.
 *
 * @param extractors the extractor functions to extract values from the Object under test.
 * @return a new assertion object whose object under test is the list containing the extracted values
 */
@CheckReturnValue
public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>> extracting(@SuppressWarnings("unchecked") Function<? super ACTUAL, Object>... extractors) {
 List<Object> values = Stream.of(extractors)
               .map(extractor -> extractor.apply(actual))
               .collect(toList());
 return newListAssertInstance(values).as(info.description());
}

代码示例来源:origin: org.assertj/assertj-core

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
@CheckReturnValue
public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>> asList() {
 objects.assertIsInstanceOf(info, actual, List.class);
 return newListAssertInstance((List<Object>) actual).as(info.description());
}

代码示例来源:origin: org.assertj/assertj-core

List<Object> extractedValues = Stream.of(keys).map(actual::get).collect(Collectors.toList());
String extractedPropertiesOrFieldsDescription = extractedDescriptionOf(keys);
String description = mostRelevantDescription(info.description(), extractedPropertiesOrFieldsDescription);
return newListAssertInstance(extractedValues).as(description);

代码示例来源:origin: joel-costigliola/assertj-core

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
@CheckReturnValue
public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>> asList() {
 objects.assertIsInstanceOf(info, actual, List.class);
 return newListAssertInstance((List<Object>) actual).as(info.description());
}

代码示例来源:origin: org.assertj/assertj-core

if (assertionError == null) {
 String description = MessageFormatter.instance().format(info.description(), info.representation(), "");
 assertionError = new AssertionError(description + String.format(errorMessage, arguments));

代码示例来源:origin: org.assertj/assertj-core

String description = mostRelevantDescription(info.description(), extractedDescription);
return newListAssertInstanceForMethodsChangingElementType(values).as(description);

代码示例来源:origin: org.assertj/assertj-core

P[] values = (P[]) FieldsOrPropertiesExtractor.extract(array, resultOf(method));
String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

代码示例来源:origin: org.assertj/assertj-core

Object[] values = FieldsOrPropertiesExtractor.extract(array, resultOf(method));
String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return new ObjectArrayAssert<>(values).as(description);

代码示例来源:origin: org.assertj/assertj-core

List<P> values = (List<P>) FieldsOrPropertiesExtractor.extract(actual, resultOf(method));
String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return newListAssertInstanceForMethodsChangingElementType(values).as(description);

代码示例来源:origin: org.assertj/assertj-core

Tuple values = byName(propertiesOrFields).extract(actual);
String extractedPropertiesOrFieldsDescription = extractedDescriptionOf(propertiesOrFields);
String description = mostRelevantDescription(info.description(), extractedPropertiesOrFieldsDescription);
return newListAssertInstance(values.toList()).as(description);

代码示例来源:origin: org.assertj/assertj-core

Object[] values = FieldsOrPropertiesExtractor.extract(actual, resultOf(method));
String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return newListAssertInstance(newArrayList(values)).withAssertionState(myself).as(description);

代码示例来源:origin: org.assertj/assertj-core

P[] values = (P[]) FieldsOrPropertiesExtractor.extract(actual, resultOf(method));
String extractedDescription = extractedDescriptionOfMethod(method);
String description = mostRelevantDescription(info.description(), extractedDescription);
return newListAssertInstance(newArrayList(values)).withAssertionState(myself).as(description);

代码示例来源:origin: org.assertj/assertj-core

Object[] values = FieldsOrPropertiesExtractor.extract(actual, byName(fieldOrProperty));
String extractedDescription = extractedDescriptionOf(fieldOrProperty);
String description = mostRelevantDescription(info.description(), extractedDescription);
return newListAssertInstance(newArrayList(values)).withAssertionState(myself).as(description);

相关文章