compound filter from filters chain (IDEA-146147)

This commit is contained in:
Anna Kozlova
2015-11-04 15:52:15 +01:00
parent ae4b083aec
commit 94e3eb2c04
15 changed files with 281 additions and 14 deletions
@@ -0,0 +1,11 @@
// "Merge filter's chain" "true"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.filter(name -> name.startsWith("A") && name.//comment2
length() > 1//comment
/*comment1*/
).findAny();
}
}
@@ -0,0 +1,8 @@
// "Merge filter's chain" "true"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.filter(name -> name.startsWith("A") && name.length() > 1).findAny();
}
}
@@ -0,0 +1,10 @@
// "Merge filter's chain" "true"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.filt<caret>er(name -> name.startsWith("A"))//comment
.filter(a -> a.//comment2
length() > 1 /*comment1*/).findAny();
}
}
@@ -0,0 +1,8 @@
// "Split into filter's chain" "false"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.fi<caret>lter(name -> name.startsWith("A")).filter().findAny();
}
}
@@ -0,0 +1,8 @@
// "Merge filter's chain" "false"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.fil<caret>ter(name -> name.startsWith("A")).map(a -> a).filter(b -> true);
}
}
@@ -0,0 +1,8 @@
// "Merge filter's chain" "true"
import java.util.stream.Stream;
class Test {
void foo(Stream<String> stringStream ) {
stringStream.filt<caret>er(name -> name.startsWith("A")).filter(a -> a.length() > 1).findAny();
}
}
@@ -0,0 +1,35 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* 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 com.intellij.codeInsight.intention;
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class MergeFilterChainActionTest extends LightIntentionActionTestCase {
public void test() throws Exception { doAllTests(); }
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/mergeFilter";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}