Giriş
System.getProperty() şeklindeki çağrıları test etmeyi kolaylaştıyor. Bence kullanması System Stubs'tan çok daha kolay
Gradle
Şöyle yaparız
testImplementation 'org.junit-pioneer:junit-pioneer:1.7.0'
Örnek
Şöyle yaparız
@Test
@ClearSystemProperty(key = "some key")
@SetSystemProperty(key = "another key", value = "new value")
void test() {
assertNull(System.getProperty("some key"));
assertEquals("new value", System.getProperty("another key"));
}
Hiç yorum yok:
Yorum Gönder