Details

Recommendation type: Mockable static invocations

Configurable in Preferences: Yes

Filter category: Mocking

Description

UTA displays this recommendation when it detects that a call to a static method or constructor that matches the specified pattern; see 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