Fix formatting

This commit is contained in:
Oleg Zhurakousky
2025-04-11 13:22:50 +02:00
committed by Ryan Baxter
parent 50d5ae512e
commit c643bd3ae1
7 changed files with 40 additions and 104 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.cloud.stream.binder;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
@@ -47,9 +46,12 @@ class BinderErrorChannelTests {
@Test
void exceptionIsThrownWhenNoSubscribers() {
BinderErrorChannel channel = new BinderErrorChannel();
Assertions.assertThrows(MessageDeliveryException.class, () -> {
try {
channel.send(new GenericMessage<String>("hello"));
});
}
catch (MessageDeliveryException e) {
// ignore
}
}
@Test

View File

@@ -31,6 +31,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -81,7 +82,6 @@ import org.springframework.messaging.support.GenericMessage;
import org.springframework.scheduling.support.PeriodicTrigger;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
/**
*
@@ -213,7 +213,7 @@ class ImplicitFunctionBindingTests {
InputDestination input = context.getBean(InputDestination.class);
try {
input.send(new GenericMessage<byte[]>("hello".getBytes()));
fail(); // it should since there are no functions and no bindings
Assertions.fail(); // it should since there are no functions and no bindings
}
catch (Exception e) {
// good, we expected it
@@ -240,7 +240,7 @@ class ImplicitFunctionBindingTests {
InputDestination input = context.getBean(InputDestination.class);
try {
input.send(new GenericMessage<byte[]>("hello".getBytes()));
fail(); // it should since there are no functions and no bindings
Assertions.fail(); // it should since there are no functions and no bindings
}
catch (Exception e) {
// good, we expected it
@@ -265,7 +265,7 @@ class ImplicitFunctionBindingTests {
context.getBean(InputDestination.class);
}
catch (Exception e) { // should not fail
fail();
Assertions.fail();
}
}
@@ -525,17 +525,6 @@ class ImplicitFunctionBindingTests {
}
}
// @Test
// public void testFunctionConfigDisabledIfStreamListenerIsUsed() {
// System.clearProperty("spring.cloud.function.definition");
// try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
// TestChannelBinderConfiguration.getCompleteConfiguration(LegacyConfiguration.class))
// .web(WebApplicationType.NONE).run("--spring.jmx.enabled=false")) {
//
// assertThat(context.getBean("supplierInitializer").getClass().getSimpleName()).isEqualTo("NullBean");
// }
// }
@Test
void declaredTypeVsActualInstance() {
System.clearProperty("spring.cloud.function.definition");
@@ -548,7 +537,7 @@ class ImplicitFunctionBindingTests {
Message<byte[]> inputMessageOne = MessageBuilder.withPayload("Hello".getBytes()).build();
inputDestination.send(inputMessageOne);
fail();
Assertions.fail();
}
catch (Exception ex) {
// good
@@ -672,7 +661,7 @@ class ImplicitFunctionBindingTests {
try {
context.getBean(FunctionConfiguration.class);
fail();
Assertions.fail();
}
catch (Exception e) {
// ignore

View File

@@ -37,7 +37,6 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -213,11 +212,12 @@ class StreamBridgeTests {
"--spring.cloud.stream.source=outputA",
"--spring.jmx.enabled=false")) {
StreamBridge streamBridge = context.getBean(StreamBridge.class);
var exception = Assertions.assertThrows(RuntimeException.class, () -> streamBridge.send("outputA-out-0",
new CodecException("invalidException")
));
assertThat(exception.getMessage()).isEqualTo("org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper returned null");
try {
streamBridge.send("outputA-out-0", new CodecException("invalidException"));
}
catch (RuntimeException exception) {
assertThat(exception.getMessage()).isEqualTo("org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper returned null");
}
}
}