本文整理了Java中org.assertj.core.api.AbstractListAssert.flatExtracting()
方法的一些代码示例,展示了AbstractListAssert.flatExtracting()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractListAssert.flatExtracting()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractListAssert
类名称:AbstractListAssert
方法名:flatExtracting
暂无
代码示例来源:origin: allure-framework/allure2
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("first", "second");
代码示例来源:origin: allure-framework/allure2
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("firstMethod", "second");
代码示例来源:origin: allure-framework/allure2
.flatExtracting("children")
.filteredOn("name", "c")
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("second");
代码示例来源: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: SonarSource/sonarqube
@Test
public void should_return_organization_specific_tags() {
OrganizationDto organization = db.organizations().insert();
RuleDefinitionDto rule = db.rules().insert(r -> r.setLanguage("java"));
RuleMetadataDto metadata = insertMetadata(organization, rule, setTags("tag1", "tag2"));
indexRules();
SearchResponse result = ws.newRequest()
.setParam("f", "tags")
.setParam("organization", organization.getKey())
.executeProtobuf(SearchResponse.class);
assertThat(result.getRulesList()).extracting(Rule::getKey).containsExactly(rule.getKey().toString());
assertThat(result.getRulesList())
.extracting(Rule::getTags).flatExtracting(Rules.Tags::getTagsList)
.containsExactly(metadata.getTags().toArray(new String[0]));
}
代码示例来源:origin: allure-framework/allure2
.flatExtracting("children")
.filteredOn("name", "s1")
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("first");
.flatExtracting("children")
.filteredOn("name", "s2")
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("first", "second");
.flatExtracting("children")
.filteredOn("name", "s3")
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("second");
代码示例来源: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
@Issue("587")
@Issue("572")
@Test
public void shouldSortByStartTimeAsc() throws Exception {
final Category category = new Category().setName("some");
final TestResult first = new TestResult()
.setName("first")
.setStatus(Status.FAILED)
.setTime(new Time().setStart(10L));
first.addExtraBlock(CATEGORIES, singletonList(category));
final TestResult second = new TestResult()
.setName("second")
.setStatus(Status.FAILED)
.setTime(new Time().setStart(12L));
second.addExtraBlock(CATEGORIES, singletonList(category));
final TestResult timeless = new TestResult()
.setName("timeless")
.setStatus(Status.FAILED);
timeless.addExtraBlock(CATEGORIES, singletonList(category));
final Tree<TestResult> tree = CategoriesPlugin.getData(
createSingleLaunchResults(second, first, timeless)
);
assertThat(tree.getChildren())
.flatExtracting("children")
.flatExtracting("children")
.extracting("name")
.containsExactly("timeless", "first", "second");
}
代码示例来源:origin: allure-framework/allure2
.filteredOn("name", "C1")
.flatExtracting("children")
.flatExtracting("children")
.extracting("name")
.containsExactlyInAnyOrder("first", "third");
代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guicier
@Test
public void itAddsProvidedTask() {
ProvidedTask providedTask = guiceBundle.getInjector().getInstance(ProvidedTask.class);
assertThat(environment.admin())
.extracting("tasks")
.flatExtracting("tasks")
.containsOnlyOnce(providedTask);
}
代码示例来源:origin: opencypher/cypher-for-gremlin
@Test
@SuppressWarnings("unchecked")
public void pathInPatternComprehension() throws Exception {
submitAndGet("CREATE (a:A), (:A), (:A) " +
" CREATE (a)-[:HAS]->(:B)");
String cypher = "MATCH (n:A) " +
"RETURN [p = (n)-[:HAS]->() | p] AS ps";
List<Map<String, Object>> results = submitAndGet(cypher);
assertThat(results)
.hasSize(3)
.extracting("ps")
.flatExtracting(m -> ((Collection) m))
.flatExtracting(m -> m )
.extracting("_label")
.contains("A", "HAS", "B");
}
代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guicier
@Test
public void itAddsBoundTask() {
InjectedTask injectedTask = guiceBundle.getInjector().getInstance(InjectedTask.class);
assertThat(environment.admin())
.extracting("tasks")
.flatExtracting("tasks")
.containsOnlyOnce(injectedTask);
}
代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guicier
@Test
public void itAddsBoundServerLifecycleListener() {
InjectedServerLifecycleListener injectedServerLifecycleListener =
guiceBundle.getInjector().getInstance(InjectedServerLifecycleListener.class);
assertThat(environment.lifecycle())
.extracting(Function.identity())
.flatExtracting("lifecycleListeners")
.extracting("listener")
.containsOnlyOnce(injectedServerLifecycleListener);
}
代码示例来源:origin: com.hubspot.dropwizard/dropwizard-guicier
@Test
public void itAddsProvidedServerLifecycleListener() {
ProvidedServerLifecycleListener providedServerLifecycleListener =
guiceBundle.getInjector().getInstance(ProvidedServerLifecycleListener.class);
assertThat(environment.lifecycle())
.extracting(Function.identity())
.flatExtracting("lifecycleListeners")
.extracting("listener")
.containsOnlyOnce(providedServerLifecycleListener);
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
public void getMailboxesShouldReturnEmptyListWhenNoMailboxes() {
GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
.build();
MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
List<JmapResponse> getMailboxesResponse = getMailboxesMethod.process(getMailboxesRequest, clientId, mailboxSession).collect(Collectors.toList());
assertThat(getMailboxesResponse)
.hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMailboxesResponse.class)
.extracting(GetMailboxesResponse.class::cast)
.flatExtracting(GetMailboxesResponse::getList)
.isEmpty();
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
public void getMailboxesShouldNotFailWhenMailboxManagerErrors() throws Exception {
MailboxManager mockedMailboxManager = mock(MailboxManager.class);
when(mockedMailboxManager.list(any()))
.thenReturn(ImmutableList.of(new MailboxPath("namespace", "user", "name")));
when(mockedMailboxManager.getMailbox(any(MailboxPath.class), any()))
.thenThrow(new MailboxException());
GetMailboxesMethod testee = new GetMailboxesMethod(mockedMailboxManager, mailboxFactory, new DefaultMetricFactory());
GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
.build();
MailboxSession session = new MockMailboxSession(USERNAME);
List<JmapResponse> getMailboxesResponse = testee.process(getMailboxesRequest, clientId, session).collect(Collectors.toList());
assertThat(getMailboxesResponse)
.hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMailboxesResponse.class)
.extracting(GetMailboxesResponse.class::cast)
.flatExtracting(GetMailboxesResponse::getList)
.isEmpty();
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
public void getMailboxesShouldReturnInboxWithSortOrder10() throws Exception {
MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "INBOX");
mailboxManager.createMailbox(mailboxPath, mailboxSession);
GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
.build();
List<JmapResponse> getMailboxesResponse = getMailboxesMethod.process(getMailboxesRequest, clientId, mailboxSession).collect(Collectors.toList());
assertThat(getMailboxesResponse)
.hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMailboxesResponse.class)
.extracting(GetMailboxesResponse.class::cast)
.flatExtracting(GetMailboxesResponse::getList)
.extracting(Mailbox::getSortOrder)
.containsOnly(SortOrder.of(10));
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
public void getMailboxesShouldReturnSortOrder1000OnUnknownFolder() throws Exception {
MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "unknown");
mailboxManager.createMailbox(mailboxPath, mailboxSession);
GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
.build();
List<JmapResponse> getMailboxesResponse = getMailboxesMethod.process(getMailboxesRequest, clientId, mailboxSession).collect(Collectors.toList());
assertThat(getMailboxesResponse)
.hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMailboxesResponse.class)
.extracting(GetMailboxesResponse.class::cast)
.flatExtracting(GetMailboxesResponse::getList)
.extracting(Mailbox::getSortOrder)
.containsOnly(SortOrder.of(1000));
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
public void getMailboxesShouldReturnInboxWithSortOrder10OnDifferenceCase() throws Exception {
MailboxSession mailboxSession = mailboxManager.createSystemSession(USERNAME);
MailboxPath mailboxPath = MailboxPath.forUser(USERNAME, "InBoX");
mailboxManager.createMailbox(mailboxPath, mailboxSession);
GetMailboxesRequest getMailboxesRequest = GetMailboxesRequest.builder()
.build();
List<JmapResponse> getMailboxesResponse = getMailboxesMethod.process(getMailboxesRequest, clientId, mailboxSession).collect(Collectors.toList());
assertThat(getMailboxesResponse)
.hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMailboxesResponse.class)
.extracting(GetMailboxesResponse.class::cast)
.flatExtracting(GetMailboxesResponse::getList)
.extracting(Mailbox::getSortOrder)
.containsOnly(SortOrder.of(10));
}
代码示例来源:origin: org.apache.james/james-server-jmap
@Test
@SuppressWarnings("unchecked")
public void processShouldReturnEmptyTextBodyAndHtmlBodyWhenThoseAreEmpty() throws Exception {
MessageManager inbox = mailboxManager.getMailbox(inboxPath, session);
ComposedMessageId message = inbox.appendMessage(
AppendCommand.from(org.apache.james.mime4j.dom.Message.Builder.of()
.setSubject("message 1 subject")
.setBody("", "html", StandardCharsets.UTF_8)),
session);
GetMessagesRequest request = GetMessagesRequest.builder()
.ids(ImmutableList.of(message.getMessageId()))
.build();
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
.extracting(JmapResponse::getResponse)
.hasOnlyElementsOfType(GetMessagesResponse.class)
.extracting(GetMessagesResponse.class::cast)
.flatExtracting(GetMessagesResponse::list)
.extracting(Message::getId, Message::getTextBody, Message::getHtmlBody)
.containsOnly(Tuple.tuple(message.getMessageId(), Optional.empty(), Optional.of("")));
}
内容来源于网络,如有侵权,请联系作者删除!