mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
Tests for soutc, serrc; use JavaLanguage.INSTANCE.getDisplayName() for Java
Review ID: IDEA-CR-60451 GitOrigin-RevId: ea77644cd21b8d34ba4060f7c12106f290c50764
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8e905ce4db
commit
149e5de1f7
@@ -80,7 +80,7 @@ public abstract class JavaCodeContextType extends TemplateContextType {
|
||||
|
||||
public static class Generic extends JavaCodeContextType {
|
||||
public Generic() {
|
||||
super("JAVA_CODE", JavaBundle.message("live.template.context.java"), EverywhereContextType.class);
|
||||
super("JAVA_CODE", JavaLanguage.INSTANCE.getDisplayName(), EverywhereContextType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
|
||||
class Foo {
|
||||
|
||||
static void foo(List<String> ls) {
|
||||
ls.forEach(System.out::println<caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
|
||||
class Foo {
|
||||
|
||||
static void foo(List<String> ls) {
|
||||
ls.forEach(<caret>);
|
||||
}
|
||||
}
|
||||
@@ -229,6 +229,21 @@ class Outer {
|
||||
startTemplate("soutp", "output")
|
||||
checkResult()
|
||||
}
|
||||
|
||||
void testSoutConsumerApplicability() {
|
||||
for (String name : ["soutc", "serrc"]) {
|
||||
TemplateImpl template = (TemplateImpl)TemplateSettings.getInstance().getTemplate(name, "output")
|
||||
assert !isApplicable('class Foo {void x(){ <caret>JUNK }}', template)
|
||||
assert !isApplicable('class Foo {void x(java.util.stream.IntStream is){ is.map(<caret>JUNK) }}', template)
|
||||
assert isApplicable('class Foo {void x(java.util.stream.IntStream is){ is.peek(<caret>JUNK) }}', template)
|
||||
}
|
||||
}
|
||||
|
||||
void testSoutConsumer() {
|
||||
configure()
|
||||
startTemplate("soutc", "output")
|
||||
checkResult()
|
||||
}
|
||||
|
||||
private boolean isApplicable(String text, TemplateImpl inst) throws IOException {
|
||||
myFixture.configureByText("a.java", text)
|
||||
|
||||
@@ -1181,7 +1181,6 @@ external.annotations.roots=Annotation Roots
|
||||
inspection.stream.api.migration.can.be.replaced.with.call=Can be replaced with ''{0}'' call
|
||||
highlight.suppressed.warnings.choose.inspections=Choose Inspections to Highlight Suppressed Problems from
|
||||
inspection.magic.constants.should.be.one.of.values=Should be one of: {0}{1,choice,0#|1# or their combination}
|
||||
live.template.context.java=Java
|
||||
live.template.context.consumer.function=Consumer function
|
||||
live.template.context.statement=Statement
|
||||
live.template.context.expression=Expression
|
||||
|
||||
Reference in New Issue
Block a user