private static void verifyNoFileAppender(Logger logger) { Iterator<Appender<ILoggingEvent>> iterator = logger.iteratorForAppenders(); while (iterator.hasNext()) { assertThat(iterator.next()).isNotInstanceOf(FileAppender.class); } }
@Test public void isInNonBlockingThreadFalse() { assertThat(Thread.currentThread()).isNotInstanceOf(NonBlocking.class); assertThat(Schedulers.isInNonBlockingThread()).as("isInNonBlockingThread").isFalse(); }
@Before public void checkNotCached() { assertThat(scheduler()).isNotInstanceOf(Schedulers.CachedScheduler.class); }
@Test public void nonSerializedSinkMultiProducer() throws Exception { TopicProcessor<Integer> processor = TopicProcessor.<Integer>builder() .share(true) .build(); FluxSink<Integer> sink = processor.sink(); assertThat(sink).isNotInstanceOf(SerializedSink.class); assertThat(sink.next(1)).isNotInstanceOf(SerializedSink.class); }
private void assertPreConditions() { Throwable thrown = catchThrowable(() -> SerializationUtils.clone(nonSerializableNamingException)); assertThat(thrown).isNotNull(); assertThat(thrown.getCause()) .isInstanceOf(NotSerializableException.class); thrown = catchThrowable(() -> SerializationUtils.clone(serializableNamingException)); assertThat(thrown).isNull(); assertThat(nonSerializableResolvedObj).isNotInstanceOf(Serializable.class); thrown = catchThrowable(() -> SerializationUtils.clone(serializableResolvedObj)); assertThat(thrown).isNull(); }
private void assertPreconditions() { Throwable thrown = catchThrowable(() -> SerializationUtils.clone(nonSerializableNamingException)); assertThat(thrown).isNotNull(); assertThat(thrown.getCause()).isInstanceOf(NotSerializableException.class); thrown = catchThrowable(() -> SerializationUtils.clone(serializableNamingException)); assertThat(thrown).isNull(); assertThat(nonSerializableResolvedObj).isNotInstanceOf(Serializable.class); thrown = catchThrowable(() -> SerializationUtils.clone(serializableResolvedObj)); assertThat(thrown).isNull(); assertThat(nonSerializablePrincipal).isNotInstanceOf(Serializable.class); thrown = catchThrowable(() -> SerializationUtils.clone(serializablePrincipal)); assertThat(thrown).isNull(); }
@Test public void normalHasNoQueueOperations() { final FluxPeekFuseableTest.AssertQueueSubscription<String> assertQueueSubscription = new FluxPeekFuseableTest.AssertQueueSubscription<>(); assertQueueSubscription.offer("foo"); UsingWhenSubscriber<String, String> test = new UsingWhenSubscriber<>(new LambdaSubscriber<>(null, null, null, null), "resource", it -> Mono.empty(), it -> Mono.empty(), null, Mockito.mock(Operators.DeferredSubscription.class)); test.onSubscribe(assertQueueSubscription); assertThat(test).isNotInstanceOf(Fuseable.QueueSubscription.class); }
@Test public void configure_no_rotation_on_sonar_file() { settings.getProps().set("sonar.log.rollingPolicy", "none"); LoggerContext ctx = underTest.configure(); Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME); Appender<ILoggingEvent> appender = rootLogger.getAppender("file_sonar"); assertThat(appender) .isNotInstanceOf(RollingFileAppender.class) .isInstanceOf(FileAppender.class); }
@Test public void monoFromFluxThatIsItselfFromMono() { AtomicBoolean emitted = new AtomicBoolean(); AtomicBoolean terminated = new AtomicBoolean(); AtomicBoolean cancelled = new AtomicBoolean(); AtomicBoolean succeeded = new AtomicBoolean(); Mono<String> withCallback = Mono.just("foo") .doOnNext(v -> emitted.set(true)); Mono<String> original = withCallback .doOnCancel(() -> cancelled.set(true)) .doOnSuccess(v -> succeeded.set(true)) .doOnTerminate(() -> terminated.set(true)) .hide(); assertThat(withCallback).as("withCallback is not Callable") .isNotInstanceOf(Fuseable.ScalarCallable.class) .isNotInstanceOf(Callable.class); assertThat(original).as("original is not callable Mono") .isNotInstanceOf(Fuseable.class) .isNotInstanceOf(Fuseable.ScalarCallable.class) .isNotInstanceOf(Callable.class); Flux<String> firstConversion = Flux.from(original); Mono<String> secondConversion = Mono.from(firstConversion); assertThat(secondConversion.block()).isEqualTo("foo"); assertThat(emitted).as("emitted").isTrue(); assertThat(succeeded).as("succeeded").isTrue(); assertThat(cancelled).as("cancelled").isFalse(); assertThat(terminated).as("terminated").isTrue(); assertThat(secondConversion).as("conversions negated").isSameAs(original); }
@Test public void xmlWithCustomElementsCanBeUnMarshalledByAnotherService() { CacheConfig cache = new CacheConfig(); setBasicValues(cache); cache.getCustomCacheElements().add(new ElementOne("test")); cache.getCustomCacheElements().add(new ElementTwo("test")); String prettyXml = service.marshall(cache); System.out.println(prettyXml); CacheConfig cacheConfig = service2.unMarshall(prettyXml); List elements = cacheConfig.getCustomCacheElements(); assertThat(elements.get(0)).isNotInstanceOf(ElementOne.class); assertThat(elements.get(1)).isNotInstanceOf(ElementTwo.class); String uglyXml = service2.marshall(cacheConfig); System.out.println(uglyXml); assertThat(uglyXml).isNotEqualTo(prettyXml); // the xml can be unmarshalled correctly by the first service String newXml = service.marshall(service.unMarshall(uglyXml)); assertThat(newXml).isEqualTo(prettyXml); }
@Test public void createRollingPolicy_none() { props.set("sonar.log.rollingPolicy", "none"); LoggerContext ctx = underTest.getRootContext(); LogbackHelper.RollingPolicy policy = underTest.createRollingPolicy(ctx, props, "sonar"); Appender appender = policy.createAppender("SONAR_FILE"); assertThat(appender).isNotInstanceOf(RollingFileAppender.class).isInstanceOf(FileAppender.class); }
@Test public void nonSerializedSinkMultiProducer() throws Exception { int count = 1000; WorkQueueProcessor<Integer> queueProcessor = WorkQueueProcessor.<Integer>builder() .share(true) .build(); TestSubscriber subscriber = new TestSubscriber(count); queueProcessor.subscribe(subscriber); FluxSink<Integer> sink = queueProcessor.sink(); Assertions.assertThat(sink).isNotInstanceOf(SerializedSink.class); for (int i = 0; i < count; i++) { sink = sink.next(i); Assertions.assertThat(sink).isNotInstanceOf(SerializedSink.class); } subscriber.await(Duration.ofSeconds(5)); assertNull("Unexpected exception in subscriber", subscriber.failure); }
@DisplayName("non-ws URI does not return WebsocketClientTransport") @Test void clientForUriInvalid() { assertThat(UriTransportRegistry.clientForUri("amqp://localhost")) .isNotInstanceOf(TcpClientTransport.class) .isNotInstanceOf(WebsocketClientTransport.class); }
@DisplayName("non-ws URI does not return WebsocketServerTransport") @Test void serverForUriInvalid() { assertThat(UriTransportRegistry.serverForUri("amqp://localhost")) .isNotInstanceOf(TcpServerTransport.class) .isNotInstanceOf(WebsocketServerTransport.class); }
@DisplayName("non-tcp URI does not return TcpClientTransport") @Test void clientForUriInvalid() { assertThat(UriTransportRegistry.clientForUri("amqp://localhost")) .isNotInstanceOf(TcpClientTransport.class) .isNotInstanceOf(WebsocketClientTransport.class); }
@DisplayName("non-tcp URI does not return TcpServerTransport") @Test void serverForUriInvalid() { assertThat(UriTransportRegistry.serverForUri("amqp://localhost")) .isNotInstanceOf(TcpServerTransport.class) .isNotInstanceOf(WebsocketServerTransport.class); }
private void assertDefaultClusterConfigurationCorrect(ClusterConfiguration cluster) { assertThat(cluster) .isInstanceOf(DefaultClusterConfiguration.class) .isNotInstanceOf(KubernetesClusterConfiguration.class); assertThat(cluster.clusterMembers()).hasSameElementsAs(SERVERS); assertThat(cluster.localServer()).isEqualTo(LOCAL_SERVER); }
@DisplayName("non-local URI does not return LocalServerTransport") @Test void serverForUriInvalid() { assertThat(UriTransportRegistry.serverForUri("http://localhost")) .isNotInstanceOf(LocalServerTransport.class); } }
@DisplayName("non-local URI does not return LocalClientTransport") @Test void clientForUriInvalid() { assertThat(UriTransportRegistry.clientForUri("http://localhost")) .isNotInstanceOf(LocalClientTransport.class); }
@Test public void testContextConfiguration() { assertThat(applicationContext.getBeansOfType(CamelContextConfiguration.class)).hasSize(2); assertThat(applicationContext.getBeansOfType(ActivityTracker.class)).hasSize(1); assertThat(applicationContext.getBeansOfType(ActivityTracker.class).values()).hasAtLeastOneElementOfType(ActivityTracker.SysOut.class); assertThat(camelContext.getLogListeners()).hasAtLeastOneElementOfType(IntegrationLoggingListener.class); assertThat(camelContext.getUuidGenerator()).isNotInstanceOf(DefaultUuidGenerator.class); } }