Repository zu Vorlesung Prog3
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 776B

123456789101112131415161718192021222324252627282930313233
  1. import org.junit.jupiter.api.Test;
  2. import static org.mockito.Mockito.*;
  3. class ExecutorTest {
  4. @Test
  5. void printHelloWoldOnStdOut() {
  6. HelloWorldWriter outMock = mock(OutWriter.class);
  7. HelloWorldWriter errMock = mock(ErrorWriter.class);
  8. Executor.printHelloWorld(outMock, errMock, false);
  9. verify(outMock, times(1)).writeHelloWorld();
  10. verify(errMock, times(0)).writeHelloWorld();
  11. }
  12. @Test
  13. void printHelloWoldOnStdErr() {
  14. HelloWorldWriter outMock = mock(OutWriter.class);
  15. HelloWorldWriter errMock = mock(ErrorWriter.class);
  16. Executor.printHelloWorld(outMock, errMock, true);
  17. verify(outMock, times(0)).writeHelloWorld();
  18. verify(errMock, times(1)).writeHelloWorld();
  19. }
  20. }