Test and comment for IDEA-176340 "Optional.isPresent not highlighted"

Actually was fixed in 0234c70
This commit is contained in:
Tagir Valeev
2017-07-21 17:13:52 +07:00
parent f290cffefc
commit 926a541520
3 changed files with 6 additions and 4 deletions
@@ -1,4 +1,4 @@
// "Replace Optional.isPresent() condition with functional style expression" "true"
// "Replace Optional.isPresent() condition with functional style expression" "GENERIC_ERROR_OR_WARNING"
import java.util.*;
@@ -6,6 +6,6 @@ public class Main {
String myString;
public void testOptional(Optional<String> str) {
str.ifPresent(s -> myString = s);
str.ifPresent(s -> myString = s.isEmpty() ? null : s);
}
}
@@ -1,4 +1,4 @@
// "Replace Optional.isPresent() condition with functional style expression" "true"
// "Replace Optional.isPresent() condition with functional style expression" "GENERIC_ERROR_OR_WARNING"
import java.util.*;
@@ -7,7 +7,7 @@ public class Main {
public void testOptional(Optional<String> str) {
if (str.isPrese<caret>nt()) {
myString = str.get();
myString = str.get().isEmpty() ? null : str.get();
}
}
}