/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemstubs/SystemInExecuteAroundUnitTest.java
20 строк
550 B
Ashley Frieze
BAEL-4742 System Stubs example tests
25 ноя 2020, 02:38
25 ноя 2020, 02:38
3c01b8f
Код
Авторство
О чём код?
package com.baeldung.systemstubs; import org.junit.jupiter.api.Test; import java.util.Scanner; import static org.assertj.core.api.Assertions.assertThat; import static uk.org.webcompere.systemstubs.SystemStubs.withTextFromSystemIn; class SystemInExecuteAroundUnitTest { @Test void givenTextInSystemIn_thenCanReadIt() throws Exception { withTextFromSystemIn("line1", "line2", "line3") .execute(() -> { assertThat(new Scanner(System.in).nextLine()) .isEqualTo("line1"); }); } }