Restore BindingHandlerAdviseTests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.cloud.stream.config;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.junit.Test;
|
||||
@@ -27,20 +30,18 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesBindException;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
|
||||
import org.springframework.cloud.stream.messaging.Processor;
|
||||
import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
// see https://github.com/spring-cloud/spring-cloud-stream/issues/1573 for more details
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Soby Chacko
|
||||
*
|
||||
*/
|
||||
public class BindingHandlerAdviseTests {
|
||||
@@ -74,11 +75,15 @@ public class BindingHandlerAdviseTests {
|
||||
fail();
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class NonValidatedConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> processor() {
|
||||
return s -> s;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties
|
||||
public NonValidatedClass nonValidatedClass() {
|
||||
@@ -100,11 +105,15 @@ public class BindingHandlerAdviseTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableBinding(Processor.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
@EnableAutoConfiguration
|
||||
public static class ValidatedConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> processor() {
|
||||
return s -> s;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties
|
||||
public ValidatedClass nonValidatedClass() {
|
||||
@@ -126,15 +135,18 @@ public class BindingHandlerAdviseTests {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EnableBinding(Sink.class)
|
||||
@Import(TestChannelBinderConfiguration.class)
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties(ValidatedProps.class)
|
||||
class SampleConfiguration {
|
||||
|
||||
@Bean
|
||||
public Consumer<String> sink() {
|
||||
return System.out::println;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ConfigurationProperties("props")
|
||||
Reference in New Issue
Block a user