本文整理汇总了Java中org.assertj.core.data.Index类的典型用法代码示例。如果您正苦于以下问题:Java Index类的具体用法?Java Index怎么用?Java Index使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Index类属于org.assertj.core.data包,在下文中一共展示了Index类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: allowEmptyConstructorToBuildDefaultClock
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void allowEmptyConstructorToBuildDefaultClock() {
testAppender.clearEvents();
HttpContext context = new BasicHttpContext();
context.setAttribute(HTTP_TARGET_HOST, "http://www.google.com");
OutboundRequestLoggingInterceptor interceptor = new OutboundRequestLoggingInterceptor();
interceptor.process(new BasicHttpRequest("GET", "/something"), context);
interceptor.process(new BasicHttpResponse(new BasicStatusLine(ANY_PROTOCOL, 200, "any")), context);
assertThat(testAppender.getEvents()).extracting("message")
.contains("Outbound request start", Index.atIndex(0))
.contains("Outbound request finish", Index.atIndex(1));
}
开发者ID:hmcts,项目名称:java-logging,代码行数:17,代码来源:OutboundRequestLoggingInterceptorTest.java
示例2: dataSupplierListenerShouldCollectMetaData
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void dataSupplierListenerShouldCollectMetaData() {
run(DataProviderTransformer.class.getName(),
ArraysDataSupplierTests.class,
CollectionsDataSupplierTests.class,
StreamsDataSupplierTests.class,
SingleObjectsDataSupplierTests.class,
TupleDataSupplierTests.class,
DataSupplierWithCustomNamesTests.class,
InjectedArgsDataSupplierTests.class,
ParallelDataSupplierTests.class,
InternalFactoryTests.class
);
final List<DataSupplierInterceptor> interceptors = getInterceptors();
assertThat(interceptors).hasSize(2);
assertThat(StreamEx.of(interceptors)
.map(DataSupplierInterceptor::getMetaData)
.flatMap(StreamEx::of)
.toList())
.extracting(DataSupplierMetaData::getDataSupplierMethod)
.extracting(Method::getName)
.hasSize(55)
.contains("getConstructorData", Index.atIndex(10));
}
开发者ID:sskorol,项目名称:test-data-supplier,代码行数:28,代码来源:DataSupplierTests.java
示例3: should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
Index index = atIndex(0);
try {
arraysWithCustomComparisonStrategy.assertDoesNotContain(info, actual, 'A', index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, 'A', index, caseInsensitiveComparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:CharArrays_assertDoesNotContain_at_Index_Test.java
示例4: should_fail_if_actual_does_not_contain_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
AssertionInfo info = someInfo();
short value = 6;
Index index = atIndex(1);
try {
arrays.assertContains(info, actual, value, index);
} catch (AssertionError e) {
short found = 8;
verify(failures).failure(info, shouldContainAtIndex(actual, value, index, found));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:15,代码来源:ShortArrays_assertContains_at_Index_Test.java
示例5: should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
byte value = 6;
Index index = atIndex(0);
try {
arraysWithCustomComparisonStrategy.assertDoesNotContain(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index, absValueComparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:ByteArrays_assertDoesNotContain_at_Index_Test.java
示例6: should_fail_if_actual_does_not_satisfy_condition_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_satisfy_condition_at_index() {
condition.shouldMatch(false);
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
lists.assertIs(info, actual, condition, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldBeAtIndex(actual, condition, index, "Luke"));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:List_assertIs_Test.java
示例7: should_fail_if_actual_contains_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index() {
AssertionInfo info = someInfo();
Index index = atIndex(0);
try {
arrays.assertDoesNotContain(info, actual, 6, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, (byte) 6, index));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:ByteArrays_assertDoesNotContain_at_Index_with_Integer_Argument_Test.java
示例8: should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
short value = 6;
Index index = atIndex(0);
try {
arraysWithCustomComparisonStrategy.assertDoesNotContain(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index, absValueComparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:ShortArrays_assertDoesNotContain_at_Index_Test.java
示例9: should_fail_if_actual_does_not_contain_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
double value = 6;
Index index = atIndex(1);
thrown.expectAssertionError(shouldContainAtIndex(actual, value, index, 8d));
arrays.assertContains(someInfo(), actual, value, index);
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:DoubleArrays_assertContains_at_Index_Test.java
示例10: should_fail_if_actual_does_not_contain_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
arrays.assertContains(info, actual, 6, index);
} catch (AssertionError e) {
byte found = 8;
verify(failures).failure(info, shouldContainAtIndex(actual, (byte) 6, index, found));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:ByteArrays_assertContains_at_Index_with_Integer_Argument_Test.java
示例11: should_fail_if_actual_contains_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index() {
AssertionInfo info = someInfo();
byte value = 6;
Index index = atIndex(0);
try {
arrays.assertDoesNotContain(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:ByteArrays_assertDoesNotContain_at_Index_Test.java
示例12: should_fail_if_actual_does_not_contain_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
lists.assertContains(info, actual, "Han", index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, "Han", index, "Luke"));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:Lists_assertContains_Test.java
示例13: should_fail_if_actual_contains_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index() {
AssertionInfo info = someInfo();
Index index = atIndex(0);
try {
lists.assertDoesNotContain(info, actual, "Yoda", index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, "Yoda", index));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:Lists_assertDoesNotContain_Test.java
示例14: conditionIsMetAtIndex
import org.assertj.core.data.Index; //导入依赖的package包/类
private <T> boolean conditionIsMetAtIndex(AssertionInfo info, List<T> actual, Condition<? super T> condition, Index index) {
assertNotNull(info, actual);
assertNotNull(condition);
Iterables.instance().assertNotEmpty(info, actual);
checkIndexValueIsValid(index, actual.size() - 1);
return condition.matches(actual.get(index.value));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:Lists.java
示例15: should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index_according_to_custom_comparison_strategy() {
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
listsWithCaseInsensitiveComparisonStrategy.assertContains(info, actual, "Han", index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, "Han", index, "Luke", comparisonStrategy));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:Lists_assertContains_Test.java
示例16: assertDoesNotContain
import org.assertj.core.data.Index; //导入依赖的package包/类
void assertDoesNotContain(AssertionInfo info, Failures failures, Object array, Object value, Index index) {
assertNotNull(info, array);
checkIndexValueIsValid(index, Integer.MAX_VALUE);
if (index.value >= sizeOf(array)) return;
if (areEqual(Array.get(array, index.value), value))
throw failures.failure(info, shouldNotContainAtIndex(array, value, index, comparisonStrategy));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:Arrays.java
示例17: should_fail_if_actual_contains_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_contains_value_at_index() {
AssertionInfo info = someInfo();
short value = 6;
Index index = atIndex(0);
try {
arrays.assertDoesNotContain(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldNotContainAtIndex(actual, value, index));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:ShortArrays_assertDoesNotContain_at_Index_Test.java
示例18: should_fail_if_actual_does_not_satisfy_condition_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_satisfy_condition_at_index() {
condition.shouldMatch(false);
AssertionInfo info = someInfo();
Index index = atIndex(1);
try {
lists.assertHas(info, actual, condition, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldHaveAtIndex(actual, condition, index, "Luke"));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:Lists_assertHas_Test.java
示例19: should_create_error_message
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test public void should_create_error_message() {
ErrorMessageFactory factory = shouldHaveAtIndex(newArrayList("Yoda", "Luke"), new TestCondition<String>("red lightsaber"), Index.atIndex(1), "Luke");
String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
assertThat(message).isEqualTo(String.format(
"[Test] %nExpecting:%n <\"Luke\">%nat index <1> to have:%n <red lightsaber>%nin:%n" +
" <[\"Yoda\", \"Luke\"]>%n"));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:ShouldHaveAtIndex_create_Test.java
示例20: should_fail_if_actual_does_not_contain_value_at_index
import org.assertj.core.data.Index; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_value_at_index() {
AssertionInfo info = someInfo();
boolean value = true;
Index index = atIndex(1);
try {
arrays.assertContains(info, actual, value, index);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainAtIndex(actual, value, index, false));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:14,代码来源:BooleanArrays_assertContains_at_Index_Test.java
注:本文中的org.assertj.core.data.Index类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论