1234567891011121314151617181920212223242526272829303132 |
- package Praktikum02;
-
- import org.junit.jupiter.api.Test;
-
- import static org.junit.jupiter.api.Assertions.*;
- import static org.mockito.Mockito.*;
-
- class ExecutorTest {
-
- @Test
- void printHelloWorldOnStdOut() {
- IHelloWorldWriter outMock = mock(OutWriter.class);
- IHelloWorldWriter errMock = mock(ErrorWriter.class);
-
- Executor.printHellowWorld(outMock, errMock ,false);
-
- verify(outMock,times(1)).writeHelloWorld();
- verify(errMock,times(0)).writeHelloWorld();
-
- }
- @Test
- void printHelloWorldOnErrorOut() {
- IHelloWorldWriter outMock = mock(OutWriter.class);
- IHelloWorldWriter errMock = mock(ErrorWriter.class);
-
- Executor.printHellowWorld(outMock, errMock ,true);
-
- verify(outMock,times(0)).writeHelloWorld();
- verify(errMock,times(1)).writeHelloWorld();
-
- }
- }
|