mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract method: fix test so they dont test if conditions
GitOrigin-RevId: 7282f25d9aa56643b42f1ef6a279dd1a7bf53a09
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e0ab2347fd
commit
a1baa62c1b
+3
-1
@@ -2,8 +2,10 @@ class Foo {
|
||||
boolean bar(String[][] a) {
|
||||
for (int i = 0; i < a.length; i++)
|
||||
for (int j = 0; i < a[i].length; j++) {<selection>
|
||||
if (a[i][j].length() > 3 && i % 3 == 0)
|
||||
if (a[i][j].length() > 3 && i % 3 == 0) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
</selection>
|
||||
}
|
||||
return false;
|
||||
|
||||
+3
-1
@@ -9,8 +9,10 @@ class Foo {
|
||||
}
|
||||
|
||||
private boolean newMethod(String[][] a, int i, int j) {
|
||||
if (a[i][j].length() > 3 && i % 3 == 0)
|
||||
if (a[i][j].length() > 3 && i % 3 == 0) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,8 +1,10 @@
|
||||
class Foo {
|
||||
boolean bar(String[] a) {
|
||||
for (int i = 0; i < a.length; i++) {<selection>
|
||||
if (a[i].length() > 3 && i % 3 == 0)
|
||||
if (a[i].length() > 3 && i % 3 == 0) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
</selection>}
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-1
@@ -7,8 +7,10 @@ class Foo {
|
||||
}
|
||||
|
||||
private boolean newMethod(String[] a, int i) {
|
||||
if (a[i].length() > 3 && i % 3 == 0)
|
||||
if (a[i].length() > 3 && i % 3 == 0) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ class Test {
|
||||
public void test(int x, int y) {
|
||||
while (x < 10) {
|
||||
x++;
|
||||
<selection>if (x == y) return;</selection>
|
||||
<selection>if (x == y) {
|
||||
System.out.println();
|
||||
return;
|
||||
}</selection>
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ class Test {
|
||||
}
|
||||
|
||||
private boolean newMethod(int x, int y) {
|
||||
if (x == y) return true;
|
||||
if (x == y) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
class Test{
|
||||
public void foo() {
|
||||
if (cond1){
|
||||
<selection>if (cond2) return;</selection>
|
||||
public void foo() {
|
||||
if (cond1){
|
||||
<selection>if (cond2) {
|
||||
System.out.println();
|
||||
return;
|
||||
}</selection>
|
||||
}
|
||||
else if (cond3){
|
||||
}
|
||||
x();
|
||||
}
|
||||
else if (cond3){
|
||||
}
|
||||
x();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
class Test{
|
||||
public void foo() {
|
||||
if (cond1){
|
||||
if (newMethod()) return;
|
||||
public void foo() {
|
||||
if (cond1){
|
||||
if (newMethod()) return;
|
||||
}
|
||||
else if (cond3){
|
||||
}
|
||||
x();
|
||||
}
|
||||
else if (cond3){
|
||||
}
|
||||
x();
|
||||
}
|
||||
|
||||
private boolean newMethod() {
|
||||
if (cond2) return true;
|
||||
if (cond2) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ class Test {
|
||||
public void test(int x, int y) {
|
||||
while (x < 10) {
|
||||
x++;
|
||||
<selection>if (x == y) break;</selection>
|
||||
<selection>if (x == y) {
|
||||
System.out.println();
|
||||
break;
|
||||
}</selection>
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
+4
-1
@@ -8,7 +8,10 @@ class Test {
|
||||
}
|
||||
|
||||
private boolean newMethod(int x, int y) {
|
||||
if (x == y) return true;
|
||||
if (x == y) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
class Test {
|
||||
public void test(int x, int y) {
|
||||
while (x < y) {
|
||||
<selection>if (x == y) continue;</selection>
|
||||
<selection>if (x == y) {
|
||||
System.out.println();
|
||||
continue;
|
||||
}</selection>
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -7,7 +7,10 @@ class Test {
|
||||
}
|
||||
|
||||
private boolean newMethod(int x, int y) {
|
||||
if (x == y) return true;
|
||||
if (x == y) {
|
||||
System.out.println();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user