Added Unit Test Case for ConsoleAndOut class

This commit is contained in:
Tarun Jain 2020-07-26 02:46:59 +05:30
parent e9e98ecc8e
commit efd1705136

View File

@ -0,0 +1,27 @@
package com.baeldung.consoleout;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
class ConsoleAndOutUnitTest {
@Test
void whenRetreivingConsole_thenPrintConsoleObject() {
assertThrows(NullPointerException.class, () -> {
ConsoleAndOut.printConsoleObject();
});
}
@Test
void whenReadingPassword_thenReadPassword() {
assertThrows(NullPointerException.class, () -> {
ConsoleAndOut.readPasswordFromConsole();
});
}
@Test
void whenRetrievingSysOut_thenPrintSysOutObject() {
ConsoleAndOut.printSysOut();
}
}