本文整理了Java中org.assertj.core.api.AbstractListAssert.describedAs()
方法的一些代码示例,展示了AbstractListAssert.describedAs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractListAssert.describedAs()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractListAssert
类名称:AbstractListAssert
方法名:describedAs
暂无
代码示例来源:origin: allure-framework/allure2
@Test
public void shouldPickUpAttachmentsForAfters() throws IOException {
Set<TestResult> testResults = process(
"allure2/simple-testcase.json", generateTestResultName(),
"allure2/first-testgroup.json", generateTestResultContainerName(),
"allure2/second-testgroup.json", generateTestResultContainerName(),
"allure2/after-sample-attachment.txt", "after-sample-attachment.txt"
).getResults();
assertThat(testResults)
.describedAs("Test case is not found")
.hasSize(1)
.flatExtracting(TestResult::getAfterStages)
.describedAs("Test case should have afters")
.hasSize(2)
.flatExtracting(StageResult::getAttachments)
.describedAs("Second after method should have an attachment")
.hasSize(1)
.extracting(Attachment::getName)
.describedAs("Attachment's name is unexpected")
.containsExactly("String attachment in after");
}
代码示例来源:origin: allure-framework/allure2
@Test
public void shouldPickUpAttachmentsForTestCase() throws IOException {
Set<TestResult> testResults = process(
"allure2/simple-testcase.json", generateTestResultName(),
"allure2/first-testgroup.json", generateTestResultContainerName(),
"allure2/second-testgroup.json", generateTestResultContainerName(),
"allure2/test-sample-attachment.txt", "test-sample-attachment.txt"
).getResults();
assertThat(testResults)
.describedAs("Test case is not found")
.hasSize(1)
.extracting(TestResult::getTestStage)
.flatExtracting(StageResult::getSteps)
.describedAs("Test case should have one step")
.hasSize(1)
.flatExtracting(Step::getAttachments)
.describedAs("Step should have an attachment")
.hasSize(1)
.extracting(Attachment::getName)
.containsExactly("String attachment in test");
}
代码示例来源:origin: HubSpot/Singularity
@Test
public void testSchedulerDropsMultipleScheduledTaskInstances() {
initScheduledRequest();
SingularityDeploy deploy = SingularityDeploy.newBuilder(requestId, firstDeployId)
.setCommand(Optional.of("sleep 100"))
.build();
SingularityDeployRequest singularityDeployRequest = new SingularityDeployRequest(deploy, Optional.absent(), Optional.absent(), Optional.absent());
deployResource.deploy(singularityDeployRequest, singularityUser);
scheduler.drainPendingQueue();
requestManager.addToPendingQueue(new SingularityPendingRequest(requestId, firstDeployId,
Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli(),
Optional.absent(), PendingType.NEW_DEPLOY, Optional.absent(), Optional.absent()));
SingularityRunNowRequest runNowRequest = new SingularityRunNowRequestBuilder().build();
requestResource.scheduleImmediately(singularityUser, requestId, runNowRequest);
Assert.assertEquals("Both requests make it into the pending queue", 2, requestManager.getPendingRequests().size());
Assert.assertEquals(PendingType.IMMEDIATE, requestManager.getPendingRequests().get(0).getPendingType());
Assert.assertEquals(PendingType.NEW_DEPLOY, requestManager.getPendingRequests().get(1).getPendingType());
scheduler.drainPendingQueue();
Assertions.assertThat(taskManager.getPendingTaskIds())
.describedAs("Only the immediate request gets run")
.hasSize(1)
.extracting(SingularityPendingTaskId::getPendingType)
.containsExactly(PendingType.IMMEDIATE);
Assertions.assertThat(requestManager.getPendingRequests())
.describedAs("The scheduled request is dropped from the pending queue")
.hasSize(0);
}
代码示例来源:origin: FaustXVI/junit5-docker
@When("^the tests are started only after the string `([^`]*)` is found in the container's logs$")
public void waitForLogStep(String wantedLog) {
assertThat(compiledClass.waitAnnotations())
.describedAs("Java code and expectation mismatch on waited log \"%s\"", wantedLog)
.contains(wantedLog);
assertThat(containers.logs()
.anyMatch(s -> s.contains(wantedLog)))
.describedAs("Logs should contains \"%s\"", wantedLog)
.isTrue();
}
代码示例来源:origin: hibernate/hibernate-search
@Test
public void testQueryOnClassBridgeField() {
Session s = openSession();
FullTextSession session = Search.getFullTextSession( s );
Transaction tx = s.beginTransaction();
QueryDescriptor query = ElasticsearchQueries.fromQueryString( "fullName:\"Klaus Hergesheimer\"" );
List<?> result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Class-bridge provided string field" ).containsExactlyInAnyOrder( 1L );
query = ElasticsearchQueries.fromQueryString( "age:34" );
result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Class-bridge provided numeric field" ).containsExactlyInAnyOrder( 1L );
tx.commit();
s.close();
}
代码示例来源:origin: hibernate/hibernate-search
@Test
public void testQueryOnNullToken() {
Session s = openSession();
FullTextSession session = Search.getFullTextSession( s );
Transaction tx = s.beginTransaction();
QueryDescriptor query = ElasticsearchQueries.fromQueryString( "firstName:<NULL>" );
List<?> result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Querying null-encoded String" ).containsExactlyInAnyOrder( 2L );
query = ElasticsearchQueries.fromQueryString( "dateOfBirth:1970-01-01" );
result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Querying null-encoded Date" ).containsExactlyInAnyOrder( 2L );
query = ElasticsearchQueries.fromQueryString( "active:false" );
result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Querying null-encoded Boolean" ).containsExactlyInAnyOrder( 2L );
query = ElasticsearchQueries.fromQueryString( "driveWidth:\\-1" );
result = session.createFullTextQuery( query, GolfPlayer.class ).list();
assertThat( result ).extracting( "id" ).describedAs( "Querying null-encoded Integer" ).containsExactlyInAnyOrder( 2L );
tx.commit();
s.close();
}
代码示例来源:origin: hibernate/hibernate-search
assertThat( result ).extracting( "id" ).describedAs( "Geo distance query" ).containsExactlyInAnyOrder( 1, 2, 3, 4 );
代码示例来源:origin: com.hubspot/SingularityService
@Test
public void testSchedulerDropsMultipleScheduledTaskInstances() {
initScheduledRequest();
SingularityDeploy deploy = SingularityDeploy.newBuilder(requestId, firstDeployId)
.setCommand(Optional.of("sleep 100"))
.build();
SingularityDeployRequest singularityDeployRequest = new SingularityDeployRequest(deploy, Optional.absent(), Optional.absent(), Optional.absent());
deployResource.deploy(singularityDeployRequest, singularityUser);
scheduler.drainPendingQueue();
requestManager.addToPendingQueue(new SingularityPendingRequest(requestId, firstDeployId,
Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli(),
Optional.absent(), PendingType.NEW_DEPLOY, Optional.absent(), Optional.absent()));
SingularityRunNowRequest runNowRequest = new SingularityRunNowRequestBuilder().build();
requestResource.scheduleImmediately(singularityUser, requestId, runNowRequest);
Assert.assertEquals("Both requests make it into the pending queue", 2, requestManager.getPendingRequests().size());
Assert.assertEquals(PendingType.IMMEDIATE, requestManager.getPendingRequests().get(0).getPendingType());
Assert.assertEquals(PendingType.NEW_DEPLOY, requestManager.getPendingRequests().get(1).getPendingType());
scheduler.drainPendingQueue();
Assertions.assertThat(taskManager.getPendingTaskIds())
.describedAs("Only the immediate request gets run")
.hasSize(1)
.extracting(SingularityPendingTaskId::getPendingType)
.containsExactly(PendingType.IMMEDIATE);
Assertions.assertThat(requestManager.getPendingRequests())
.describedAs("The scheduled request is dropped from the pending queue")
.hasSize(0);
}
代码示例来源:origin: hibernate/hibernate-search
.setSort( new Sort( new DistanceSortField( 24, 32, "location" ) ) )
.list();
assertThat( result ).extracting( "id" ).describedAs( "Geo distance query" ).containsExactlyInAnyOrder( 1, 2, 3 );
代码示例来源:origin: hibernate/hibernate-search
@Test
public void testCombinedQueryOnIndexWithSortFieldAndIndexToBeUninverted() throws Exception {
Transaction tx = fullTextSession.beginTransaction();
Query query = queryParser.parse( "name:Bill" );
FullTextQuery hibQuery = fullTextSession.createFullTextQuery( query, Plumber.class, BrickLayer.class );
Sort sort = new Sort( new SortField( "sortName", SortField.Type.STRING ) ); //ASC
hibQuery.setSort( sort );
@SuppressWarnings("unchecked")
List<Book> result = hibQuery.list();
assertNotNull( result );
assertThat( result ).extracting( "name" )
.describedAs( "Expecting results from index with sort field and uninverted index in the correct sort order" )
.containsExactly( "Bill the brick layer", "Bill the plumber" );
tx.commit();
}
代码示例来源:origin: hibernate/hibernate-search
.describedAs( "Sortable field via programmatic config" )
.containsExactly( (short) 3354, (short) 3454, (short) 3554 );
.describedAs( "Sortable field via programmatic config" )
.containsExactly( 1, 2, 3 );
代码示例来源:origin: hibernate/hibernate-search
.describedAs( "Retrieved facets - values" )
.containsExactly( "[, 50.0)", "[50.0, 1000.0)", "[1000.0, ]" );
assertThat( facets ).extracting( "count" )
.describedAs( "Retrieved facets - counts" )
.containsExactly( 2, 1, 1 );
代码示例来源:origin: hibernate/hibernate-search
.describedAs( "Can load results originating from different id spaces, using different id types and names" )
.containsExactlyInAnyOrder(
"Southern Florida College of Golf",
内容来源于网络,如有侵权,请联系作者删除!