Fixed DataBufferUtilsTest on Windows

DataBufferUtilsTests checked for newline characters before, resulting in
failures on Windows.
This commit is contained in:
Arjen Poutsma 2016-07-18 17:08:46 +02:00
parent 03e6eeeadc
commit 041437f3ee
2 changed files with 12 additions and 14 deletions

View File

@ -42,15 +42,15 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
.toURI(); .toURI();
FileChannel channel = FileChannel.open(Paths.get(uri), StandardOpenOption.READ); FileChannel channel = FileChannel.open(Paths.get(uri), StandardOpenOption.READ);
Flux<DataBuffer> flux = DataBufferUtils.read(channel, this.bufferFactory, 4); Flux<DataBuffer> flux = DataBufferUtils.read(channel, this.bufferFactory, 3);
TestSubscriber TestSubscriber
.subscribe(flux) .subscribe(flux)
.assertNoError() .assertNoError()
.assertComplete() .assertComplete()
.assertValuesWith( .assertValuesWith(
stringConsumer("foo\n"), stringConsumer("bar\n"), stringConsumer("foo"), stringConsumer("bar"),
stringConsumer("baz\n"), stringConsumer("qux\n")); stringConsumer("baz"), stringConsumer("qux"));
assertFalse(channel.isOpen()); assertFalse(channel.isOpen());
} }
@ -61,16 +61,17 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
.toURI(); .toURI();
FileChannel channel = FileChannel.open(Paths.get(uri), StandardOpenOption.READ); FileChannel channel = FileChannel.open(Paths.get(uri), StandardOpenOption.READ);
Flux<DataBuffer> flux = DataBufferUtils.read(channel, this.bufferFactory, 3); Flux<DataBuffer> flux = DataBufferUtils.read(channel, this.bufferFactory, 2);
TestSubscriber TestSubscriber
.subscribe(flux) .subscribe(flux)
.assertNoError() .assertNoError()
.assertComplete() .assertComplete()
.assertValuesWith( .assertValuesWith(
stringConsumer("foo"), stringConsumer("\nba"), stringConsumer("fo"), stringConsumer("ob"),
stringConsumer("r\nb"), stringConsumer("az\n"), stringConsumer("ar"), stringConsumer("ba"),
stringConsumer("qux"), stringConsumer("\n")); stringConsumer("zq"), stringConsumer("ux")
);
assertFalse(channel.isOpen()); assertFalse(channel.isOpen());
} }
@ -80,15 +81,15 @@ public class DataBufferUtilsTests extends AbstractDataBufferAllocatingTestCase {
InputStream is = DataBufferUtilsTests.class InputStream is = DataBufferUtilsTests.class
.getResourceAsStream("DataBufferUtilsTests.txt"); .getResourceAsStream("DataBufferUtilsTests.txt");
Flux<DataBuffer> flux = DataBufferUtils.read(is, this.bufferFactory, 4); Flux<DataBuffer> flux = DataBufferUtils.read(is, this.bufferFactory, 3);
TestSubscriber TestSubscriber
.subscribe(flux) .subscribe(flux)
.assertNoError() .assertNoError()
.assertComplete() .assertComplete()
.assertValuesWith( .assertValuesWith(
stringConsumer("foo\n"), stringConsumer("bar\n"), stringConsumer("foo"), stringConsumer("bar"),
stringConsumer("baz\n"), stringConsumer("qux\n")); stringConsumer("baz"), stringConsumer("qux"));
} }
@Test @Test