extract method: fix test so they dont test if conditions

GitOrigin-RevId: 7282f25d9aa56643b42f1ef6a279dd1a7bf53a09
This commit is contained in:
Alexandr Suhinin
2020-05-06 13:56:03 +00:00
committed by intellij-monorepo-bot
parent e0ab2347fd
commit a1baa62c1b
12 changed files with 57 additions and 25 deletions
@@ -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;
@@ -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;
}
}
@@ -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;
}
@@ -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();
}
@@ -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,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++;
}
}
@@ -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;
}
}