本文整理汇总了Java中org.assertj.core.internal.Failures类的典型用法代码示例。如果您正苦于以下问题:Java Failures类的具体用法?Java Failures怎么用?Java Failures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Failures类属于org.assertj.core.internal包,在下文中一共展示了Failures类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: anyFilterMatches
import org.assertj.core.internal.Failures; //导入依赖的package包/类
private CompositeQueryFilterAssert anyFilterMatches(@NonNull final Predicate<IQueryFilter> p)
{
isNotNull();
@SuppressWarnings("unchecked")
final List<IQueryFilter> filters = actual.getFilters();
for (final IQueryFilter filter : filters)
{
if (p.test(filter))
{
return this;
}
}
throw Failures.instance().failure(info, elementsShouldSatisfyAny(actual));
}
开发者ID:metasfresh,项目名称:metasfresh,代码行数:16,代码来源:CompositeQueryFilterAssert.java
示例2: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
doubles = new Doubles();
doubles.setFailures(failures);
absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Double>());
doublesWithAbsValueComparisonStrategy = new Doubles(absValueComparisonStrategy);
doublesWithAbsValueComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:DoublesBaseTest.java
示例3: doesNotEndWithNode
import org.assertj.core.internal.Failures; //导入依赖的package包/类
public RelationshipAssert doesNotEndWithNode(Node node) {
Objects.instance().assertNotNull(info, actual);
Node actualEndNode = actual.getEndNode();
checkActualRelationshipNode(actualEndNode, "The actual end node should not be null");
checkArgumentNode(node, "The end node to look for should not be null");
if (actualEndNode.equals(node)) {
throw Failures.instance().failure(info, shouldNotEndWithNode(actual, node));
}
return this;
}
开发者ID:joel-costigliola,项目名称:assertj-neo4j,代码行数:14,代码来源:RelationshipAssert.java
示例4: withThreadDumpOnError
import org.assertj.core.internal.Failures; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF withThreadDumpOnError() {
Failures.instance().enablePrintThreadDump();
return myself;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:AbstractAssert.java
示例5: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
strings = new Strings();
strings.failures = failures;
comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
stringsWithCaseInsensitiveComparisonStrategy = new Strings(comparisonStrategy);
stringsWithCaseInsensitiveComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:StringsBaseTest.java
示例6: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
diff = mock(Diff.class);
failures = spy(new Failures());
inputStreams = new InputStreams();
inputStreams.diff = diff;
inputStreams.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:9,代码来源:InputStreamsBaseTest.java
示例7: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
condition = new TestCondition<>();
conditions = new Conditions();
conditions.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:ConditionsBaseTest.java
示例8: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
characters = new Characters();
characters.failures = failures;
caseInsensitiveComparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveCharacterComparator.instance);
charactersWithCaseInsensitiveComparisonStrategy = new Characters(caseInsensitiveComparisonStrategy);
charactersWithCaseInsensitiveComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:CharactersBaseTest.java
示例9: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
shorts = new Shorts();
shorts.setFailures(failures);
absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Short>());
shortsWithAbsValueComparisonStrategy = new Shorts(absValueComparisonStrategy);
shortsWithAbsValueComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:ShortsBaseTest.java
示例10: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
comparables = new Comparables();
comparables.failures = failures;
customComparisonStrategy = new ComparatorBasedComparisonStrategy(comparatorForCustomComparisonStrategy());
comparablesWithCustomComparisonStrategy = new Comparables(customComparisonStrategy);
comparablesWithCustomComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:ComparablesBaseTest.java
示例11: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
lists = new Lists();
lists.failures = failures;
comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
listsWithCaseInsensitiveComparisonStrategy = new Lists(comparisonStrategy);
listsWithCaseInsensitiveComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:ListsBaseTest.java
示例12: should_not_filter_when_global_remove_option_is_disabled
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Test
public void should_not_filter_when_global_remove_option_is_disabled() {
Failures.instance().setRemoveAssertJRelatedElementsFromStackTrace(false);
try {
new CustomAssert("").fail();
} catch (AssertionError e) {
assertThat(e.getStackTrace()).areAtLeastOne(elementOf(CustomAssert.class));
}
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:CustomAsserts_filter_stacktrace_Test.java
示例13: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
Failures.instance().setRemoveAssertJRelatedElementsFromStackTrace(false);
description = new TestDescription("Jedi");
factory = (ShouldBeEqual) shouldBeEqual("Luke", "Yoda", new StandardRepresentation());
constructorInvoker = mock(ConstructorInvoker.class);
factory.constructorInvoker = constructorInvoker;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:9,代码来源:ShouldBeEqual_newAssertionError_without_JUnit_and_OTA4J_Test.java
示例14: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
integers = new Integers();
integers.setFailures(failures);
absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>());
integersWithAbsValueComparisonStrategy = new Integers(absValueComparisonStrategy);
integersWithAbsValueComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:IntegersBaseTest.java
示例15: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
actual = newArrayList("Luke", "Yoda", "Leia");
failures = spy(new Failures());
iterables = new Iterables();
iterables.failures = failures;
comparisonStrategy = new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance);
iterablesWithCaseInsensitiveComparisonStrategy = new Iterables(comparisonStrategy);
iterablesWithCaseInsensitiveComparisonStrategy.failures = failures;
info = someInfo();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:12,代码来源:IterablesBaseTest.java
示例16: setUp
import org.assertj.core.internal.Failures; //导入依赖的package包/类
@Before
public void setUp() {
failures = spy(new Failures());
longs = new Longs();
longs.setFailures(failures);
absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(new AbsValueComparator<Long>());
longsWithAbsValueComparisonStrategy = new Longs(absValueComparisonStrategy);
longsWithAbsValueComparisonStrategy.failures = failures;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:LongsBaseTest.java
示例17: hasHeader
import org.assertj.core.internal.Failures; //导入依赖的package包/类
public void hasHeader(String headerName, String expectedHeaderValue) {
response.getHeaders().stream().filter(th -> th.getName().equals(headerName)).findFirst()
.map(TusHeader::getValue)
.map(value -> assertThat(value).isEqualTo(expectedHeaderValue))
.orElseThrow(() -> Failures.instance().failure(headerName + " header not present in response"));
}
开发者ID:jerbome,项目名称:tusRx,代码行数:7,代码来源:RequestHandlerTest.java
示例18: hasHeaderEndingWith
import org.assertj.core.internal.Failures; //导入依赖的package包/类
public void hasHeaderEndingWith(String headerName, String expectedHeaderValue) {
response.getHeaders().stream().filter(th -> th.getName().equals(headerName)).findFirst()
.map(TusHeader::getValue)
.map(value -> assertThat(value).endsWith(expectedHeaderValue))
.orElseThrow(() -> Failures.instance().failure(headerName + " header not present in response"));
}
开发者ID:jerbome,项目名称:tusRx,代码行数:7,代码来源:RequestHandlerTest.java
示例19: newAssertionError
import org.assertj.core.internal.Failures; //导入依赖的package包/类
/**
* Creates an <code>{@link AssertionError}</code> indicating that an assertion that verifies that two objects are
* equal failed.<br>
* The <code>{@link AssertionError}</code> message is built so that it differentiates {@link #actual} and
* {@link #expected} description in case their string representation are the same (like 42 float and 42 double).
* <p>
* If JUnit 4 is in the classpath and the description is standard (no comparator was used and {@link #actual} and
* {@link #expected} string representation were different), this method will instead create a
* org.junit.ComparisonFailure that highlights the difference(s) between the expected and actual objects.
* </p>
* <p>
* If opentest4j is on the classpath then {@code org.opentest4j.AssertionFailedError} would be used.
* </p>
* {@link AssertionError} stack trace won't show AssertJ related elements if {@link Failures} is configured to filter
* them (see {@link Failures#setRemoveAssertJRelatedElementsFromStackTrace(boolean)}).
*
* @param description the description of the failed assertion.
* @param representation the {@link Representation} used to format values.
* @return the created {@code AssertionError}.
*/
@Override
public AssertionError newAssertionError(Description description, Representation representation) {
// only use JUnit error message if the comparison strategy used was standard, otherwise we need to mention
// comparison strategy in the assertion error message to make it clear to the user it was used.
if (comparisonStrategy.isStandard() && !actualAndExpectedHaveSameStringRepresentation()) {
// comparison strategy is standard -> try to build a JUnit ComparisonFailure that is nicely displayed in IDEs.
AssertionError error = comparisonFailure(description);
// error != null means that JUnit 4 was in the classpath and we were to build a ComparisonFailure.
if (error != null) return error;
}
String message = smartErrorMessage(description, representation);
AssertionError assertionFailedError = assertionFailedError(message);
if (assertionFailedError != null) return assertionFailedError;
// No JUnit in the classpath => fall back to default error message
return Failures.instance().failure(message);
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:37,代码来源:ShouldBeEqual.java
示例20: actualDoesNotStartWithSequence
import org.assertj.core.internal.Failures; //导入依赖的package包/类
private AssertionError actualDoesNotStartWithSequence(AssertionInfo info, Object[] sequence) {
return Failures.instance()
.failure(info, shouldStartWith("Stream under test", sequence, iterables.getComparisonStrategy()));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:5,代码来源:ProxyableListAssert.java
注:本文中的org.assertj.core.internal.Failures类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论