Я использую следующую зависимость: < /p>
Код: Выделить всё
org.mockito
mockito-junit-jupiter
2.23.0
test
< /code>
Вот мой пример теста: < /p>
@ExtendWith(MockitoExtension.class)
public class TestEnvVariable {
@Mock
System system;
@Test
public void shouldExpandPropertyContentToMatchingSysEnv() throws Exception {
when(system.getenv("KEY")).thenReturn("VALUE");
assertEquals("VALUE", "KEY");
}
}
Подробнее здесь: https://stackoverflow.com/questions/647 ... ith-junit5