Properly handle Flux<?> and Flux<Object> in WebFlux
Issue: SPR-15464
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -55,6 +55,9 @@ public class ByteArrayEncoderTests extends AbstractDataBufferAllocatingTestCase
|
||||
MimeTypeUtils.TEXT_PLAIN));
|
||||
assertTrue(this.encoder.canEncode(ResolvableType.forClass(byte[].class),
|
||||
MimeTypeUtils.APPLICATION_JSON));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -55,6 +55,9 @@ public class ByteBufferEncoderTests extends AbstractDataBufferAllocatingTestCase
|
||||
MimeTypeUtils.TEXT_PLAIN));
|
||||
assertTrue(this.encoder.canEncode(ResolvableType.forClass(ByteBuffer.class),
|
||||
MimeTypeUtils.APPLICATION_JSON));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -58,6 +58,9 @@ public class CharSequenceEncoderTests extends AbstractDataBufferAllocatingTestCa
|
||||
MimeTypeUtils.TEXT_PLAIN));
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.forClass(String.class),
|
||||
MimeTypeUtils.APPLICATION_JSON));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -47,6 +47,9 @@ public class DataBufferEncoderTests extends AbstractDataBufferAllocatingTestCase
|
||||
MimeTypeUtils.TEXT_PLAIN));
|
||||
assertTrue(this.encoder.canEncode(ResolvableType.forClass(DataBuffer.class),
|
||||
MimeTypeUtils.APPLICATION_JSON));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -32,6 +32,7 @@ import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,9 @@ public class ResourceEncoderTests extends AbstractDataBufferAllocatingTestCase {
|
||||
MimeTypeUtils.TEXT_PLAIN));
|
||||
assertTrue(this.encoder.canEncode(ResolvableType.forClass(InputStreamResource.class),
|
||||
MimeTypeUtils.APPLICATION_JSON));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -68,6 +68,9 @@ public class ResourceRegionEncoderTests extends AbstractDataBufferAllocatingTest
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.forClass(Resource.class), allMimeType));
|
||||
assertTrue(this.encoder.canEncode(resourceRegion, MimeTypeUtils.APPLICATION_OCTET_STREAM));
|
||||
assertTrue(this.encoder.canEncode(resourceRegion, allMimeType));
|
||||
|
||||
// SPR-15464
|
||||
assertFalse(this.encoder.canEncode(ResolvableType.NONE, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user