mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 15:41:26 +07:00
more java tests moved to community
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if ((!c)) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c != d) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c == d) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
void foo () {
|
||||
int a = 0, b = 0;
|
||||
for (;;) {
|
||||
<caret>if (a != b) {
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
void foo() {
|
||||
String[] entries = null;
|
||||
for (String entry : entries) {
|
||||
<caret>if (entry != null) {
|
||||
System.out.println("not null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
if (<caret>!c) {
|
||||
b();
|
||||
}
|
||||
else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
b();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
return;
|
||||
}
|
||||
a();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
return;
|
||||
}
|
||||
a();
|
||||
b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo(boolean c) {
|
||||
<caret>if (c) {
|
||||
foo();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Invert If Condition" "true"
|
||||
public class C {
|
||||
public static int main(String[] args) {
|
||||
if (!a) {
|
||||
foo();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
private static void foo() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
for (int i = 0;;i++) {
|
||||
<caret>if (!c) {
|
||||
continue;
|
||||
}
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public static void foo() {
|
||||
if (1 == 2) {
|
||||
return;
|
||||
}
|
||||
// very important comment here
|
||||
System.out.println("something");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public static void foo() {
|
||||
<caret>if (1 + 2 != 3) {
|
||||
}
|
||||
else {
|
||||
System.out.println("say");
|
||||
}
|
||||
System.out.println("something");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// "Invert If Condition" "true"
|
||||
class K {
|
||||
private void bar(int i) {
|
||||
switch(i) {
|
||||
case 0:
|
||||
if (!f(i)) {
|
||||
i = 1;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
case 1:
|
||||
i = 2;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean f(int i) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class Foo {
|
||||
void foo(String[] args) {
|
||||
for (String s : args) {
|
||||
<caret>if (!"6".equals(s)) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
return null;
|
||||
}
|
||||
a();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
return null;
|
||||
}
|
||||
a();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Invert If Condition" "true"
|
||||
// else on the same line
|
||||
class TestInvertIf {
|
||||
void invertIf(Object object) {
|
||||
if (object != "adf") {
|
||||
System.out.println("1");
|
||||
} // comment
|
||||
else {
|
||||
System.out.println("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
while (true) {
|
||||
<caret>if (!c) {
|
||||
continue;
|
||||
}
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
while (true) {
|
||||
if (c) {
|
||||
<caret>if (!d) {
|
||||
continue;
|
||||
}
|
||||
a();
|
||||
break;
|
||||
}
|
||||
else if (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) a(); else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if ((c)) a(); else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c == d) a(); else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c != d) a(); else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) a(); else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
void foo () {
|
||||
int a = 0, b = 0;
|
||||
for (;;) {
|
||||
<caret>if (a == b) continue;
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
void foo() {
|
||||
String[] entries = null;
|
||||
for (String entry : entries) {
|
||||
<caret>if (entry == null)
|
||||
continue;
|
||||
System.out.println("not null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
if (<caret>c) a();
|
||||
else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) {}
|
||||
else b();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) a();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) {
|
||||
a();
|
||||
b();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo(boolean c) {
|
||||
<caret>if (!c) return;
|
||||
foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
public class C {
|
||||
public static int main(String[] args) {
|
||||
<caret>if (a) return 2;
|
||||
foo();
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static void foo() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
for (int i = 0;;i++) {
|
||||
<caret>if (c) a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public static void foo() {
|
||||
<caret>if (1 != 2) {
|
||||
// very important comment here
|
||||
System.out.println("something");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public static void foo() {
|
||||
<caret>if (1 + 2 == 3) {
|
||||
System.out.println("say");
|
||||
}
|
||||
System.out.println("something");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// "Invert If Condition" "true"
|
||||
class K {
|
||||
private void bar(int i) {
|
||||
switch(i) {
|
||||
case 0:
|
||||
<caret>if (f(i)) {
|
||||
return;
|
||||
}
|
||||
i = 1;
|
||||
break;
|
||||
case 1:
|
||||
i = 2;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean f(int i) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class Foo {
|
||||
void foo(String[] args) {
|
||||
for (String s : args) {
|
||||
<caret>if ("6".equals(s)) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) a();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (c) {
|
||||
a();
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Invert If Condition" "true"
|
||||
// else on the same line
|
||||
class TestInvertIf {
|
||||
void invertIf(Object object) {
|
||||
<caret>if (object == "adf") {
|
||||
System.out.println("2");
|
||||
} else {
|
||||
System.out.println("1");
|
||||
} // comment
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
while (true) {
|
||||
<caret>if (c) a();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Invert If Condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
while (true) {
|
||||
if (c) {
|
||||
<caret>if (d) {
|
||||
a();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user