Details

Recommendation type: Mockable static invocations

Configurable in Preferences: Yes

Filter category: Mocking

Description

UTA displays this recommendation when it detects a call to a mockable static method or constructor based on the configuration specified in Configuring Mocking Options.

Example

public static class StaticExample {
    private static boolean value = false; 
    public static void setValue(boolean newValue) {
        value = newValue;
    }
}
public class Example {
    public void setValue(boolean newValue) {
        StaticExample.setValue(newValue);
    }
}
@Test
public void testSetValue() {
    boolean newValue = true;
    Example underTest = new Example();
    underTest.setValue(newValue);
}
  • No labels