Skip to content

CrossReferencesMethods test

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

Check that the algorithms will not make mutually exclusive optimization. In this situation move methodA1 to ClassB is good idea, also move methodB1 to ClassA is good idea, but do both movement at once is bad idea.

Expected refactorings
Member Move to
ClassA.methodA1() ClassB
or
Member Move to
ClassB.methodB1() ClassA
package crossReferencesMethods;

public class ClassA {
    static void methodA1() {
        ClassB.methodB1();
        ClassB.methodB1();
        ClassB.methodB1();
        ClassB.methodB1();
        ClassB.methodB1();
        ClassB.methodB1();
    }
}
package crossReferencesMethods;

public class ClassB {
    static void methodB1() {
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
        ClassA.methodA1();
    }
}