@@ -47,6 +47,7 @@ import com.amazonaws.services.lambda.runtime.events.SNSEvent;
|
||||
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
|
||||
import com.amazonaws.services.lambda.runtime.events.ScheduledEvent;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
@@ -65,7 +66,6 @@ import org.springframework.util.MimeType;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1506,7 +1506,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
try {
|
||||
invoker.handleRequest(targetStream, output, null);
|
||||
fail();
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.serverless.web;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -25,7 +26,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -55,7 +57,7 @@ public class AsyncStartTests {
|
||||
ServerlessHttpServletResponse response = new ServerlessHttpServletResponse();
|
||||
try {
|
||||
mvc.service(request, response);
|
||||
fail();
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertThat(e).isInstanceOf(IllegalStateException.class);
|
||||
|
||||
@@ -166,6 +166,8 @@ public final class FunctionTypeUtils {
|
||||
* @return instance of {@link Class} as raw representation of the provided {@link Type}
|
||||
*/
|
||||
public static Class<?> getRawType(Type type) {
|
||||
// ((WildcardType) type).getUpperBounds();
|
||||
// Class cazz = ResolvableType.forType(type).getRawClass();
|
||||
if (type instanceof WildcardType) {
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -433,9 +433,13 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
public void testReactiveFunctionWithImperativeInputAndOutputFail() {
|
||||
FunctionCatalog catalog = this.configureCatalog();
|
||||
Function<String, String> reverse = catalog.lookup("reverseFlux");
|
||||
Assertions.assertThrows(ClassCastException.class, () -> {
|
||||
try {
|
||||
String result = reverse.apply("reverseFlux");
|
||||
});
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.stream.IntStream;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.StringValue;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -491,7 +491,8 @@ public class SimpleFunctionRegistryTests {
|
||||
.build()
|
||||
));
|
||||
|
||||
Assertions.assertIterableEquals(result.blockFirst(), Arrays.asList("item1", "item2"));
|
||||
List<String> blockFirst = result.blockFirst();
|
||||
Assertions.assertThatIterable(blockFirst).isEqualTo(Arrays.asList("item1", "item2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
|
||||
@@ -27,8 +27,8 @@ import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
@@ -116,14 +116,13 @@ public class ContextFunctionCatalogInitializerTests {
|
||||
|
||||
@Test
|
||||
public void missingType() {
|
||||
Assertions.assertThrows(BeanCreationException.class, () -> {
|
||||
try {
|
||||
create(MissingTypeConfiguration.class);
|
||||
assertThat(this.context.getBean("function"))
|
||||
.isInstanceOf(FunctionRegistration.class);
|
||||
assertThat((Function<?, ?>) this.catalog.lookup(Function.class, "function"))
|
||||
.isInstanceOf(Function.class);
|
||||
// TODO: support for type inference from functional bean registrations
|
||||
});
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (BeanCreationException e) {
|
||||
// ignore, the test call must fail
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.test.StepVerifier;
|
||||
@@ -43,7 +43,6 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -83,7 +82,7 @@ public class RoutingFunctionTests {
|
||||
assertThat(function).isNotNull();
|
||||
try {
|
||||
function.apply(message);
|
||||
fail();
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Good
|
||||
@@ -207,7 +206,7 @@ public class RoutingFunctionTests {
|
||||
.build();
|
||||
try {
|
||||
function.apply(message);
|
||||
fail();
|
||||
Assertions.fail();
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertThat(e.getMessage()).isEqualTo("EL1005E: Type cannot be found 'java.lang.Runtime'");
|
||||
|
||||
Reference in New Issue
Block a user