@Test public void shouldReturnZeroIfDisabled() throws Exception { mockStatic(Configuration.class); Properties properties = new Properties(); properties.put("enabled", "false"); doReturn(properties).when(Configuration.class, "readProperties"); doCallRealMethod().when(Configuration.class, "isEnabled"); doCallRealMethod().when(Configuration.class, "loadFromProperties"); assertThat(new SomeClass().add(1, 5)).isEqualTo(0); }
public int add(int x, int y) { if (Configuration.isEnabled()) { return x + y; } return 0; }
SomeClass { public int add(int x, int y) { if (Configuration.isEnabled()) { return x + y; } return 0; } }
SomeClass { public int add(int x, int y) { if (Configuration.isEnabled()) { return x + y; } return 0; }  }
SomeClass { public int add(int x, int y) { if (Configuration.isEnabled()) { return x + y; } return 0; }  int add(int x, int y); }
SomeClass { public int add(int x, int y) { if (Configuration.isEnabled()) { return x + y; } return 0; }  int add(int x, int y);  }