Skip to content

RecursiveMethod test

Artyom Lobanov edited this page Jul 11, 2017 · 1 revision

Checks that recursive calls doesn't prevent to move method

Expected refactorings
Member Move to
ClassA.methodA1 ClassB
package recursiveMethod;

public class ClassA {

    static void methodA1() {
        methodA1();
        methodA1();
        methodA1();
        methodA1();
        methodA1();
        methodA1();
        ClassB.methodB2();
        ClassB.methodB2();
        ClassB.methodB2();
        ClassB.methodB2();
    }

    static void foo() {}
}
package recursiveMethod;

public class ClassB {
    static int attributeB1;
    static int attributeB2;

    static void methodB1() {
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
    }

    static void methodB2() {
        attributeB1 = 0;
        attributeB2 = 0;
        methodB1();
        methodB1();
        methodB1();
    }

    static void methodB3() {
        attributeB1 = 0;
        methodB1();
        methodB1();
        methodB1();
        methodB2();
        methodB2();
    }
}