// Path: src/main/java/pl/domzal/junit/docker/rule/logs/LogPrinter.java
// public class LogPrinter implements Runnable {
// 
//     private static Logger log = LoggerFactory.getLogger(LogPrinter.class);
// 
//     private final String prefix;
//     private final InputStream scannedInputStream;
//     private final PrintStream output;
//     private final LineListener lineListener;
// 
//     public LogPrinter(String prefix, InputStream scannedInputStream, PrintStream output, LineListener lineListener) {
//         this.prefix = prefix;
//         this.scannedInputStream = scannedInputStream;
//         this.output = output;
//         this.lineListener = lineListener;
//     }
// 
//     @Override
//     public void run() {
//         log.trace("{} printer thread started", prefix);
//         try (Scanner scanner = new Scanner(scannedInputStream)) {
//             while (scanner.hasNextLine()) {
//                 String line = scanner.nextLine();
//                 log.trace("{} line: {}", prefix, line);
//                 if (output != null) {
//                     output.println(prefix + line);
//                 }
//                 if (lineListener != null) {
//                     lineListener.nextLine(line);
//                 }
//             }
//         }
//         log.trace("{} printer thread terminated", prefix);
//     }
// }
// 
// Path: src/main/java/pl/domzal/junit/docker/rule/wait/LineListener.java
// public interface LineListener {
//     void nextLine(String line);
// }


import static org.mockito.Mockito.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.InOrder;
import pl.domzal.junit.docker.rule.logs.LogPrinter;
import pl.domzal.junit.docker.rule.wait.LineListener;
package pl.domzal.junit.docker.rule;





@Category(test.category.Stable.class)
public class DockerLogsLogPrinterTest {

    private final ExecutorService executor = Executors.newSingleThreadExecutor();

    private PrintWriter containerStdout;
    private ByteArrayOutputStream logOutputStream;
    LineListener lineListener = mock(LineListener.class);

// Path: src/main/java/pl/domzal/junit/docker/rule/logs/LogPrinter.java
// public class LogPrinter implements Runnable {
// 
//     private static Logger log = LoggerFactory.getLogger(LogPrinter.class);
// 
//     private final String prefix;
//     private final InputStream scannedInputStream;
//     private final PrintStream output;
//     private final LineListener lineListener;
// 
//     public LogPrinter(String prefix, InputStream scannedInputStream, PrintStream output, LineListener lineListener) {
//         this.prefix = prefix;
//         this.scannedInputStream = scannedInputStream;
//         this.output = output;
//         this.lineListener = lineListener;
//     }
// 
//     @Override
//     public void run() {
//         log.trace("{} printer thread started", prefix);
//         try (Scanner scanner = new Scanner(scannedInputStream)) {
//             while (scanner.hasNextLine()) {
//                 String line = scanner.nextLine();
//                 log.trace("{} line: {}", prefix, line);
//                 if (output != null) {
//                     output.println(prefix + line);
//                 }
//                 if (lineListener != null) {
//                     lineListener.nextLine(line);
//                 }
//             }
//         }
//         log.trace("{} printer thread terminated", prefix);
//     }
// }
// 
// Path: src/main/java/pl/domzal/junit/docker/rule/wait/LineListener.java
// public interface LineListener {
//     void nextLine(String line);
// }


// Path: src/test/java/pl/domzal/junit/docker/rule/DockerLogsLogPrinterTest.java
import static org.mockito.Mockito.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.InOrder;
import pl.domzal.junit.docker.rule.logs.LogPrinter;
import pl.domzal.junit.docker.rule.wait.LineListener;

package pl.domzal.junit.docker.rule;





@Category(test.category.Stable.class)
public class DockerLogsLogPrinterTest {

    private final ExecutorService executor = Executors.newSingleThreadExecutor();

    private PrintWriter containerStdout;
    private ByteArrayOutputStream logOutputStream;
    LineListener lineListener = mock(LineListener.class);

    LogPrinter testee;