本文整理汇总了Java中org.assertj.core.internal.StandardComparisonStrategy类的典型用法代码示例。如果您正苦于以下问题:Java StandardComparisonStrategy类的具体用法?Java StandardComparisonStrategy怎么用?Java StandardComparisonStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardComparisonStrategy类属于org.assertj.core.internal包,在下文中一共展示了StandardComparisonStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: should_fail_if_arrays_have_different_sizes_for_large_arrays
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_arrays_have_different_sizes_for_large_arrays() {
// GIVEN
Object[] actual = new Object[2000];
Object[] expected = new Object[actual.length + 1];
for (int i = 0; i < actual.length; i++) {
actual[i] = String.valueOf(i);
expected[i] = String.valueOf(i);
}
expected[actual.length] = "extra";
AssertionInfo info = someInfo();
// WHEN
try {
arrays.assertContainsExactly(info, actual, expected);
} catch (AssertionError e) {
// THEN
verify(failures).failure(info, shouldContainExactly(actual, asList(expected),
newArrayList("extra"), newArrayList(),
StandardComparisonStrategy.instance()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
示例2: should_create_error_message
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_create_error_message() {
ErrorMessageFactory factory = shouldNotContain("Yoda", "od", StandardComparisonStrategy.instance());
String message = factory.create(new TextDescription("Test"), STANDARD_REPRESENTATION);
assertThat(message).isEqualTo(format("[Test] %n" +
"Expecting:%n" +
" <\"Yoda\">%n" +
"not to contain:%n" +
" <\"od\">%n"));
}
示例3: should_create_error_message_with_several_string_values
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_create_error_message_with_several_string_values() {
ErrorMessageFactory factory = shouldNotContain("Yoda", array("od", "ya"), newSet("ya"),
StandardComparisonStrategy.instance());
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" +
"Expecting:%n" +
" <\"Yoda\">%n" +
"not to contain:%n" +
" <[\"od\", \"ya\"]>%n" +
"but found:%n" +
" <[\"ya\"]>%n"));
}
示例4: should_create_error_message
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_create_error_message() {
ErrorMessageFactory factory = shouldBeSubstring("bcd", "abcdef", StandardComparisonStrategy.instance());
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(format("[Test] %n" +
"Expecting:%n" +
" <\"bcd\">%n" +
"to be a substring of:%n" +
" <\"abcdef\">%n"));
}
示例5: should_fail_if_actual_does_not_contain_given_values_exactly
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_given_values_exactly() {
AssertionInfo info = someInfo();
Object[] expected = { "Luke", "Yoda", "Han" };
try {
iterables.assertContainsExactlyInAnyOrder(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info,
shouldContainExactlyInAnyOrder(actual, expected, newArrayList("Han"), newArrayList("Leia"), StandardComparisonStrategy.instance()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:Iterables_assertContainsExactlyInAnyOrder_Test.java
示例6: should_fail_if_actual_contains_duplicates_and_expected_does_not
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_duplicates_and_expected_does_not() {
AssertionInfo info = someInfo();
actual = newArrayList("Luke", "Leia", "Luke");
Object[] expected = { "Luke", "Leia" };
try {
iterables.assertContainsExactlyInAnyOrder(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info,
shouldContainExactlyInAnyOrder(actual, expected, emptyList(), newArrayList("Luke"), StandardComparisonStrategy.instance()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Iterables_assertContainsExactlyInAnyOrder_Test.java
示例7: should_fail_if_expected_contains_duplicates_and_actual_does_not
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_expected_contains_duplicates_and_actual_does_not() {
AssertionInfo info = someInfo();
actual = newArrayList("Luke", "Leia");
Object[] expected = { "Luke", "Leia", "Luke"};
try {
iterables.assertContainsExactlyInAnyOrder(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info,
shouldContainExactlyInAnyOrder(actual, expected, newArrayList("Luke"), emptyList(), StandardComparisonStrategy.instance()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:Iterables_assertContainsExactlyInAnyOrder_Test.java
示例8: should_fail_if_actual_contains_any_of_given_values
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_any_of_given_values() {
String[] values = { "practice", "make", "good" };
thrown.expectAssertionError(shouldNotContain("Practice makes perfect", values, newSet("make"),
StandardComparisonStrategy.instance()));
strings.assertDoesNotContain(someInfo(), "Practice makes perfect", values);
}
示例9: should_fail_if_actual_contains_all_given_values_but_size_differ
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_all_given_values_but_size_differ() {
AssertionInfo info = someInfo();
actual = array("Luke", "Leia", "Luke");
Object[] expected = { "Luke", "Leia" };
try {
arrays.assertContainsExactly(info, actual, expected);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainExactly(actual, asList(expected),
newArrayList(), newArrayList("Luke"),
StandardComparisonStrategy.instance()));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
示例10: AbstractOptionAssert
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
AbstractOptionAssert(Option<VALUE> actual, Class<?> selfType) {
super(actual, selfType);
this.optionValueComparisonStrategy = StandardComparisonStrategy.instance();
}
示例11: AbstractTryAssert
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
AbstractTryAssert(Try<VALUE> actual, Class<?> selfType) {
super(actual, selfType);
this.TryValueComparisonStrategy = StandardComparisonStrategy.instance();
}
示例12: AbstractCompletionStageAssert
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
protected AbstractCompletionStageAssert(CompletionStage<T> actual, Class<?> selfType, Duration timeout) {
super(actual.toCompletableFuture(), selfType);
this.timeout = timeout;
this.optionalValueComparisonStrategy = StandardComparisonStrategy.instance();
}
示例13: FDatesAssertions
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
@VisibleForTesting
FDatesAssertions() {
this(StandardComparisonStrategy.instance());
}
示例14: shouldContainAnyOf
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
public static ErrorMessageFactory shouldContainAnyOf(Object actual, Object expected) {
return shouldContainAnyOf(actual, expected, StandardComparisonStrategy.instance());
}
示例15: AbstractOptionalAssert
import org.assertj.core.internal.StandardComparisonStrategy; //导入依赖的package包/类
protected AbstractOptionalAssert(Optional<VALUE> actual, Class<?> selfType) {
super(actual, selfType);
this.optionalValueComparisonStrategy = StandardComparisonStrategy.instance();
}