org.assertj.core.api.iterable.Extractor Java Examples
The following examples show how to use
org.assertj.core.api.iterable.Extractor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaClassTest.java From ArchUnit with Apache License 2.0 | 5 votes |
private Extractor<JavaMember, String> memberIdentifier() { return new Extractor<JavaMember, String>() { @Override public String extract(JavaMember input) { return input.getOwner().getSimpleName() + "#" + input.getName(); } }; }
Example #2
Source File: DestinationRuleIT.java From istio-java-api with Apache License 2.0 | 4 votes |
@Test public void checkDestinationRuleWithTrafficPolicy() { //given final DestinationRule destinationRule = new DestinationRuleBuilder() .withApiVersion("networking.istio.io/v1beta1") .withNewMetadata() .withName("rule") .endMetadata() .withNewSpec() .withHost("somehost") .addNewSubset().withName("a").withLabels(new HashMap<String, String>() {{ put("version", "a"); }}).endSubset() .addNewSubset().withName("b").withLabels(new HashMap<String, String>() {{ put("version", "b"); }}).endSubset() .withNewTrafficPolicy() .withNewTls() .withMode(ClientTLSSettingsMode.DISABLE) .endTls() .endTrafficPolicy() .endSpec() .build(); //when final DestinationRule resultResource = istioClient.v1beta1DestinationRule().create(destinationRule); //then assertThat(resultResource).isNotNull().satisfies(istioResource -> { assertThat(istioResource.getKind()).isEqualTo("DestinationRule"); assertThat(istioResource) .extracting("metadata") .extracting("name") .containsOnly("rule"); }); //and final DestinationRuleSpec resultSpec = resultResource.getSpec(); //and assertThat(resultSpec).satisfies(ps -> { assertThat(ps.getHost()).isEqualTo("somehost"); assertThat(ps.getTrafficPolicy()) .extracting("tls") .extracting("mode") .containsOnly(ClientTLSSettingsMode.DISABLE); assertThat(ps.getSubsets()) .extracting((Extractor<Subset, Object>) subset -> tuple(subset.getName(), subset.getLabels()) ) .containsOnly( tuple("a", new HashMap<String, String>() {{ put("version", "a"); }}), tuple("b", new HashMap<String, String>() {{ put("version", "b"); }}) ); }); //when final Boolean deleteResult = istioClient.v1beta1DestinationRule().delete(resultResource); //then assertThat(deleteResult).isTrue(); }
Example #3
Source File: StackControllerTest.java From react-native-navigation with MIT License | 4 votes |
private void assertContainsOnlyId(String... ids) { assertThat(uut.size()).isEqualTo(ids.length); assertThat(uut.getChildControllers()).extracting((Extractor<ViewController, String>) ViewController::getId).containsOnly(ids); }
Example #4
Source File: ComponentAssert.java From litho with Apache License 2.0 | 2 votes |
/** * Extract values from the underlying component based on the {@link Extractor} provided. * * @param extractor The extractor applied to the Component. * @param <A> Type of the value extracted. * @return ListAssert for the extracted values. */ @CheckReturnValue public <A> ListAssert<A> extracting(Extractor<Component, List<A>> extractor) { final List<A> value = extractor.extract(actual); return new ListAssert<>(value); }
Example #5
Source File: SeleniumExtractor.java From bdt with Apache License 2.0 | 2 votes |
/** * Get selenium extractor. * * @return {@code Extractor<WebElement, String>} */ public static Extractor<WebElement, String> linkText() { return new SeleniumExtractor(); }