// Path: src/it/non-lifecycle/src/main/java/test/maven/plugin/profiler/PomRead.java
// public class PomRead {
// 
//     public String getPomVersion(Model model) {
//         String result = model.getVersion();
//         if (result == null) {
//             throw new IllegalArgumentException("The artifact does not define a version.");
//         }
//         return result;
//     }
// 
//     public Model readModel(InputStream is) throws IOException, XmlPullParserException {
//         MavenXpp3Reader model = new MavenXpp3Reader();
//         Model read = model.read(is);
//         return read;
//     }
// 
//     public Model readModel(File file) throws IOException, XmlPullParserException {
//         FileInputStream fis = new FileInputStream(file);
//         return readModel(fis);
//     }
// 
//     public String getVersionFromPom(File pomFile) throws IOException, XmlPullParserException {
//         Model model = readModel(pomFile);
//         return getPomVersion(model);
//     }
// 
//     public static void main(String[] args) {
//         if (args.length != 1) {
//             System.err.println("Invalid number of arguments.");
//             System.err.println("");
//             System.err.println("usage: pom.xml");
//             return;
//         }
// 
//         String pom = args[0];
//         File pomFile = new File(pom);
//         if (!pomFile.exists() || !pomFile.isFile() || !pomFile.canRead()) {
//             System.err.println("File " + pomFile + " can not be accessed or does not exist.");
//             return;
//         }
// 
//         PomRead pomRead = new PomRead();
//         try {
//             String version = pomRead.getVersionFromPom(pomFile);
//             System.out.println(version);
//         } catch (IllegalArgumentException e) {
//             System.err.println(e.getMessage());
//         } catch (IOException e) {
//             System.err.println(e.getMessage());
//         } catch (XmlPullParserException e) {
//             System.err.println(e.getMessage());
//         }
// 
//     }
// }


import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.OutputStream;
import java.io.PrintStream;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import test.maven.plugin.profiler.PomRead;

        public void println(String s) {
            consoleOutputStdOut.append(s);
            consoleOutputStdOut.append(LINE_FEED);
        }

        public void print(String s) {
            consoleOutputStdOut.append(s);
        }
    }

    private PrintStream originalStdOut;
    private PrintStream originalStdErr;

    @BeforeMethod
    public void beforeMethod() {
        consoleOutputStdErr = new StringBuilder();
        consoleOutputStdOut = new StringBuilder();

        originalStdErr = System.err;
        originalStdOut = System.out;

        PrintStream interceptorStdOut = new InterceptorStdOut(originalStdOut);
        PrintStream interceptorStdErr = new InterceptorStdErr(originalStdErr);

        System.setOut(interceptorStdOut);
        System.setErr(interceptorStdErr);
    }

    @Test
    public void shouldFailWithErrorBasedOnTooLessArguments() {

// Path: src/it/non-lifecycle/src/main/java/test/maven/plugin/profiler/PomRead.java
// public class PomRead {
// 
//     public String getPomVersion(Model model) {
//         String result = model.getVersion();
//         if (result == null) {
//             throw new IllegalArgumentException("The artifact does not define a version.");
//         }
//         return result;
//     }
// 
//     public Model readModel(InputStream is) throws IOException, XmlPullParserException {
//         MavenXpp3Reader model = new MavenXpp3Reader();
//         Model read = model.read(is);
//         return read;
//     }
// 
//     public Model readModel(File file) throws IOException, XmlPullParserException {
//         FileInputStream fis = new FileInputStream(file);
//         return readModel(fis);
//     }
// 
//     public String getVersionFromPom(File pomFile) throws IOException, XmlPullParserException {
//         Model model = readModel(pomFile);
//         return getPomVersion(model);
//     }
// 
//     public static void main(String[] args) {
//         if (args.length != 1) {
//             System.err.println("Invalid number of arguments.");
//             System.err.println("");
//             System.err.println("usage: pom.xml");
//             return;
//         }
// 
//         String pom = args[0];
//         File pomFile = new File(pom);
//         if (!pomFile.exists() || !pomFile.isFile() || !pomFile.canRead()) {
//             System.err.println("File " + pomFile + " can not be accessed or does not exist.");
//             return;
//         }
// 
//         PomRead pomRead = new PomRead();
//         try {
//             String version = pomRead.getVersionFromPom(pomFile);
//             System.out.println(version);
//         } catch (IllegalArgumentException e) {
//             System.err.println(e.getMessage());
//         } catch (IOException e) {
//             System.err.println(e.getMessage());
//         } catch (XmlPullParserException e) {
//             System.err.println(e.getMessage());
//         }
// 
//     }
// }


// Path: src/it/non-lifecycle/src/test/java/test/maven/plugin/profiler/PomReadIT.java
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.OutputStream;
import java.io.PrintStream;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import test.maven.plugin.profiler.PomRead;

        public void println(String s) {
            consoleOutputStdOut.append(s);
            consoleOutputStdOut.append(LINE_FEED);
        }

        public void print(String s) {
            consoleOutputStdOut.append(s);
        }
    }

    private PrintStream originalStdOut;
    private PrintStream originalStdErr;

    @BeforeMethod
    public void beforeMethod() {
        consoleOutputStdErr = new StringBuilder();
        consoleOutputStdOut = new StringBuilder();

        originalStdErr = System.err;
        originalStdOut = System.out;

        PrintStream interceptorStdOut = new InterceptorStdOut(originalStdOut);
        PrintStream interceptorStdErr = new InterceptorStdErr(originalStdErr);

        System.setOut(interceptorStdOut);
        System.setErr(interceptorStdErr);
    }

    @Test
    public void shouldFailWithErrorBasedOnTooLessArguments() {

        PomRead.main(new String[] {});
