Repo für das Praktikum Prog3 A
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ExecutorTest.java 850B

3 weeks ago
1234567891011121314151617181920212223242526272829303132
  1. package Praktikum02;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.*;
  4. import static org.mockito.Mockito.*;
  5. class ExecutorTest {
  6. @Test
  7. void printHelloWorldOnStdOut() {
  8. IHelloWorldWriter outMock = mock(OutWriter.class);
  9. IHelloWorldWriter errMock = mock(ErrorWriter.class);
  10. Executor.printHellowWorld(outMock, errMock ,false);
  11. verify(outMock,times(1)).writeHelloWorld();
  12. verify(errMock,times(0)).writeHelloWorld();
  13. }
  14. @Test
  15. void printHelloWorldOnErrorOut() {
  16. IHelloWorldWriter outMock = mock(OutWriter.class);
  17. IHelloWorldWriter errMock = mock(ErrorWriter.class);
  18. Executor.printHellowWorld(outMock, errMock ,true);
  19. verify(outMock,times(0)).writeHelloWorld();
  20. verify(errMock,times(1)).writeHelloWorld();
  21. }
  22. }