Eclipse/JDT Type Inference Workaround in Test
- Remove an unused type argument - Add a missing type argument
This commit is contained in:
@@ -56,6 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
@@ -177,7 +178,7 @@ public class CorrelationHandlerTests {
|
||||
return f -> f.enrichHeaders(s -> s.header("FOO", "BAR"))
|
||||
.split("testSplitterData", "buildList", c -> c.applySequence(false))
|
||||
.channel(MessageChannels.executor(taskExecutor()))
|
||||
.split(Message.class, Message::getPayload, c -> c.applySequence(false))
|
||||
.split(Message.class, Message<?>::getPayload, c -> c.applySequence(false))
|
||||
.channel(MessageChannels.executor(taskExecutor()))
|
||||
.split(s -> s
|
||||
.applySequence(false)
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.springframework.integration.dsl.channel.MessageChannels;
|
||||
import org.springframework.integration.handler.advice.IdempotentReceiverInterceptor;
|
||||
import org.springframework.integration.selector.MetadataStoreSelector;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.transformer.DecodingTransformer;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
@@ -66,6 +67,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Ian Bondoc
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
@@ -296,8 +298,10 @@ public class TransformerTests {
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow decodingFlow() {
|
||||
// TODO: Stored in an unnecessary variable to work around an eclipse type inference issue.
|
||||
DecodingTransformer<Integer> transformer = Transformers.decoding(new MyCodec(), m -> Integer.class);
|
||||
return f -> f
|
||||
.transform(Transformers.decoding(new MyCodec(), m -> Integer.class))
|
||||
.transform(transformer)
|
||||
.channel("codecReplyChannel");
|
||||
}
|
||||
|
||||
@@ -350,7 +354,7 @@ public class TransformerTests {
|
||||
return f -> f
|
||||
.enrich(e -> e.<TestPojo>requestPayload(p -> p.getPayload().getName())
|
||||
.requestSubFlow(sf -> sf
|
||||
.<String>handle(someService::aTerminatingServiceMethod))
|
||||
.handle(someService::aTerminatingServiceMethod))
|
||||
.replyChannel("enricherReplyChannel")
|
||||
.<String>headerFunction("foo", Message::getPayload)
|
||||
.propertyFunction("name", Message::getPayload))
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.file;
|
||||
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
|
||||
|
||||
/**
|
||||
* @author Iwein Fuld
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public class RecursiveDirectoryScannerTests {
|
||||
|
||||
private File subFolder;
|
||||
|
||||
private File subSubFolder;
|
||||
|
||||
private File topLevelFile;
|
||||
|
||||
private File subLevelFile;
|
||||
|
||||
private File subSubLevelFile;
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder recursivePath = new TemporaryFolder();
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
this.subFolder = this.recursivePath.newFolder("subFolder");
|
||||
this.subSubFolder = new File(this.subFolder, "subSubFolder");
|
||||
this.subSubFolder.mkdir();
|
||||
this.topLevelFile = this.recursivePath.newFile("file1");
|
||||
this.subLevelFile = new File(this.subFolder, "file2");
|
||||
this.subLevelFile.createNewFile();
|
||||
this.subSubLevelFile = new File(this.subSubFolder, "file3");
|
||||
this.subSubLevelFile.createNewFile();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnAllFilesIncludingDirs() throws IOException {
|
||||
RecursiveDirectoryScanner scanner = new RecursiveDirectoryScanner();
|
||||
scanner.setFilter(new AcceptOnceFileListFilter<>());
|
||||
List<File> files = scanner.listFiles(this.recursivePath.getRoot());
|
||||
assertEquals(5, files.size());
|
||||
assertThat(files, hasItem(this.topLevelFile));
|
||||
assertThat(files, hasItem(this.subLevelFile));
|
||||
assertThat(files, hasItem(this.subSubLevelFile));
|
||||
assertThat(files, hasItem(this.subFolder));
|
||||
assertThat(files, hasItem(this.subSubFolder));
|
||||
File file = new File(this.subSubFolder, "file4");
|
||||
file.createNewFile();
|
||||
files = scanner.listFiles(this.recursivePath.getRoot());
|
||||
assertEquals(1, files.size());
|
||||
assertThat(files, hasItem(file));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user