org.assertj.core.api.InstanceOfAssertFactories Java Examples
The following examples show how to use
org.assertj.core.api.InstanceOfAssertFactories.
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: FirefoxOptionsTest.java From selenium with Apache License 2.0 | 6 votes |
@Test public void canConvertOptionsWithPrefsToCapabilitiesAndRestoreBack() { FirefoxOptions options = new FirefoxOptions( new MutableCapabilities(new FirefoxOptions() .addPreference("string.pref", "some value") .addPreference("int.pref", 42) .addPreference("boolean.pref", true))); Object options2 = options.asMap().get(FirefoxOptions.FIREFOX_OPTIONS); assertThat(options2) .asInstanceOf(InstanceOfAssertFactories.MAP) .extractingByKey("prefs") .asInstanceOf(InstanceOfAssertFactories.MAP) .containsEntry("string.pref", "some value") .containsEntry("int.pref", 42) .containsEntry("boolean.pref", true); }
Example #2
Source File: CurrentTraceContextFactoryBeanTest.java From brave with Apache License 2.0 | 6 votes |
@Test public void scopeDecorators() { context = new XmlBeans("" + "<bean id=\"currentTraceContext\" class=\"brave.spring.beans.CurrentTraceContextFactoryBean\">\n" + " <property name=\"scopeDecorators\">\n" + " <list>\n" + " <bean class=\"brave.propagation.StrictScopeDecorator\" factory-method=\"create\"/>\n" + " </list>\n" + " </property>" + "</bean>" ); assertThat(context.getBean("currentTraceContext", CurrentTraceContext.class)) .extracting("scopeDecorators") .asInstanceOf(InstanceOfAssertFactories.ARRAY) .isNotEmpty(); }
Example #3
Source File: CorrelationScopeDecoratorFactoryBeanTest.java From brave with Apache License 2.0 | 6 votes |
@Test public void defaultFields() { context = new XmlBeans("" + "<bean id=\"correlationDecorator\" class=\"brave.spring.beans.CorrelationScopeDecoratorFactoryBean\">\n" + " <property name=\"builder\">\n" + " <bean class=\"brave.context.log4j12.MDCScopeDecorator\" factory-method=\"newBuilder\"/>\n" + " </property>\n" + "</bean>" ); assertThat(context.getBean("correlationDecorator", CorrelationScopeDecorator.class)) .extracting("fields").asInstanceOf(InstanceOfAssertFactories.ARRAY) .containsExactly( SingleCorrelationField.create(TRACE_ID), SingleCorrelationField.create(SPAN_ID) ); }
Example #4
Source File: TracingFactoryBeanTest.java From brave with Apache License 2.0 | 6 votes |
@Test public void bothSpanHandlers() { context = new XmlBeans("" + "<bean id=\"tracing\" class=\"brave.spring.beans.TracingFactoryBean\">\n" + " <property name=\"finishedSpanHandlers\">\n" + " <util:constant static-field=\"" + getClass().getName() + ".FINISHED_SPAN_HANDLER\"/>\n" + " </property>\n" + " <property name=\"spanHandlers\">\n" + " <util:constant static-field=\"" + getClass().getName() + ".SPAN_HANDLER\"/>\n" + " </property>\n" + "</bean>" ); assertThat(context.getBean("tracing", Tracing.class)) .extracting("tracer.spanHandler.delegate.handlers") .asInstanceOf(InstanceOfAssertFactories.ARRAY) .containsExactly(FINISHED_SPAN_HANDLER, SPAN_HANDLER); }
Example #5
Source File: ServiceTaskTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test @CmmnDeployment public void testGetCmmnModelWithDelegateHelper() { CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("myCase") .start(); assertThat(TestJavaDelegate01.cmmnModel).isNotNull(); assertThat(TestJavaDelegate01.cmmnElement) .asInstanceOf(InstanceOfAssertFactories.type(PlanItem.class)) .extracting(PlanItem::getName) .isEqualTo("Task One"); }
Example #6
Source File: CorrelationScopeDecoratorTest.java From spring-cloud-sleuth with Apache License 2.0 | 5 votes |
@Test public void should_only_include_whitelist() { assertThat(this.scopeDecorator).extracting("fields") .asInstanceOf( InstanceOfAssertFactories.array(SingleCorrelationField[].class)) .extracting(SingleCorrelationField::name) .containsOnly("traceId", "spanId", "bp", COUNTRY_CODE.name()); // x-vcap-request-id // is not // in the // whitelist }
Example #7
Source File: TraceBaggageConfigurationTests.java From spring-cloud-sleuth with Apache License 2.0 | 5 votes |
static ListAssert<Tuple> assertThatBaggageFieldNameToKeyNames( AssertableApplicationContext context) { return assertThat(context.getBean(Propagation.Factory.class)) .extracting("configs").asInstanceOf(InstanceOfAssertFactories.ARRAY) .extracting("field.name", "keyNames.toArray") .asInstanceOf(InstanceOfAssertFactories.list(Tuple.class)); }
Example #8
Source File: FirefoxOptionsTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void stringBasedBinaryRemainsAbsoluteIfSetAsAbsolute() { Map<String, Object> json = new FirefoxOptions().setBinary("/i/like/cheese").asMap(); assertThat(json.get(FIREFOX_OPTIONS)) .asInstanceOf(InstanceOfAssertFactories.MAP) .containsEntry("binary", "/i/like/cheese"); }
Example #9
Source File: FirefoxOptionsTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void pathBasedBinaryRemainsAbsoluteIfSetAsAbsolute() { Map<String, Object> json = new FirefoxOptions().setBinary(Paths.get("/i/like/cheese")).asMap(); assertThat(json.get(FIREFOX_OPTIONS)) .asInstanceOf(InstanceOfAssertFactories.MAP) .containsEntry("binary", "/i/like/cheese"); }
Example #10
Source File: FirefoxOptionsTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void canConvertOptionsWithArgsToCapabilitiesAndRestoreBack() { FirefoxOptions options = new FirefoxOptions( new MutableCapabilities(new FirefoxOptions().addArguments("-a", "-b"))); Object options2 = options.asMap().get(FirefoxOptions.FIREFOX_OPTIONS); assertThat(options2) .asInstanceOf(InstanceOfAssertFactories.MAP) .containsEntry("args", Arrays.asList("-a", "-b")); }
Example #11
Source File: FirefoxOptionsTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void canConvertOptionsWithBinaryToCapabilitiesAndRestoreBack() { FirefoxOptions options = new FirefoxOptions( new MutableCapabilities(new FirefoxOptions().setBinary(new FirefoxBinary()))); Object options2 = options.asMap().get(FirefoxOptions.FIREFOX_OPTIONS); assertThat(options2) .asInstanceOf(InstanceOfAssertFactories.MAP) .containsEntry("binary", new FirefoxBinary().getPath().replaceAll("\\\\", "/")); }
Example #12
Source File: CurrentTraceContextTest.java From brave with Apache License 2.0 | 5 votes |
@Test public void ignoresNoopScopeDecorator() { ScopeDecorator one = (context, scope) -> scope; CurrentTraceContext shouldHaveOnlyOne = newBuilder() .addScopeDecorator(ScopeDecorator.NOOP) .addScopeDecorator(one).build(); assertThat(shouldHaveOnlyOne).extracting("scopeDecorators") .asInstanceOf(InstanceOfAssertFactories.ARRAY) .doesNotContain(ScopeDecorator.NOOP); }
Example #13
Source File: B3PropagationTest.java From brave with Apache License 2.0 | 5 votes |
@Test public void injectKindFormats() { B3Propagation.Factory factory = (B3Propagation.Factory) B3Propagation.newFactoryBuilder() .injectFormats(Span.Kind.CLIENT, Format.SINGLE, Format.MULTI) .build(); assertThat(factory.injectorFactory).extracting("clientInjectorFunction.injectorFunctions") .asInstanceOf(InstanceOfAssertFactories.ARRAY) .containsExactly(Format.SINGLE, Format.MULTI); }
Example #14
Source File: BaggagePropagationTest.java From brave with Apache License 2.0 | 5 votes |
@Test public void extract_baggage_addsAllKeyNames_evenWhenEmpty() { TraceContextOrSamplingFlags extracted = extractor.extract(request); assertThat(extracted.extra()).hasSize(2); assertThat(extracted.extra().get(1)) .asInstanceOf(InstanceOfAssertFactories.type(Extra.class)) .extracting(a -> a.extractKeyNames) .asInstanceOf(InstanceOfAssertFactories.list(String.class)) .containsExactly("x-vcap-request-id", "x-amzn-trace-id"); }
Example #15
Source File: NoopAwareSpanHandlerTest.java From brave with Apache License 2.0 | 5 votes |
@Test public void create_multiple() { SpanHandler[] handlers = new SpanHandler[2]; handlers[0] = one; handlers[1] = two; SpanHandler handler = NoopAwareSpanHandler.create(handlers, noop); assertThat(handler).extracting("delegate.handlers") .asInstanceOf(InstanceOfAssertFactories.array(SpanHandler[].class)) .containsExactly(one, two); }