// Path: src/test/java/analyticalengine/TestUtils.java
// public final class TestUtils {
// 
//     /**
//      * The message produced when {@link #shouldHaveThrownException()} is
//      * called.
//      */
//     private static final String EXCEPTION_MSG = "Exception should have been"
//             + " thrown on previous line.";
// 
//     /**
//      * Prints the stack trace of the specified Exception to stderr and calls
//      * {@link org.junit.Assert#fail(String)} in order to fail the test in which
//      * this method is called.
//      * 
//      * @param exception
//      *            The Exception which caused the test failure.
//      */
//     public static synchronized void fail(final Throwable exception) {
//         exception.printStackTrace(System.err);
//         org.junit.Assert.fail(exception.getMessage());
//     }
// 
//     /**
//      * Fails the test in which this method is called with the message that an
//      * Exception should have been thrown on the previous line.
//      */
//     public static void shouldHaveThrownException() {
//         org.junit.Assert.fail(EXCEPTION_MSG);
//     }
// 
//     /** Instantiation disallowed. */
//     private TestUtils() {
//         // intentionally unimplemented
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import analyticalengine.TestUtils;
        // write a program that includes the file with baseName
        String withoutExtension = baseName.toString().replace(".ae", "");
        try (BufferedWriter writer = Files.newBufferedWriter(tempProgram,
                Charset.defaultCharset())) {
            writer.write("A include from library cards for "
                    + withoutExtension + "\n");
        }

        // list tempDir2 first, so we expect 28 as output
        String[] argv = new String[] { "-X", "-s", tempDir2 + ":" + tempDir1,
                tempProgram.toString() };
        Main.main(argv);
        String output = this.stdout.toString().toLowerCase();
        assertTrue(output.contains("28"));
        assertFalse(output.contains("6"));
    }

    /**
     * Test for listing the cards only.
     * 
     * @throws IOException
     *             If there is a problem reading from the test file.
     */
    @Test
    public void testList() throws IOException {
        Path testfile;
        try {
            testfile = Paths.get(this.getClass().getResource("/test_basic.ae")
                    .toURI());
        } catch (URISyntaxException e) {
// Path: src/test/java/analyticalengine/TestUtils.java
// public final class TestUtils {
// 
//     /**
//      * The message produced when {@link #shouldHaveThrownException()} is
//      * called.
//      */
//     private static final String EXCEPTION_MSG = "Exception should have been"
//             + " thrown on previous line.";
// 
//     /**
//      * Prints the stack trace of the specified Exception to stderr and calls
//      * {@link org.junit.Assert#fail(String)} in order to fail the test in which
//      * this method is called.
//      * 
//      * @param exception
//      *            The Exception which caused the test failure.
//      */
//     public static synchronized void fail(final Throwable exception) {
//         exception.printStackTrace(System.err);
//         org.junit.Assert.fail(exception.getMessage());
//     }
// 
//     /**
//      * Fails the test in which this method is called with the message that an
//      * Exception should have been thrown on the previous line.
//      */
//     public static void shouldHaveThrownException() {
//         org.junit.Assert.fail(EXCEPTION_MSG);
//     }
// 
//     /** Instantiation disallowed. */
//     private TestUtils() {
//         // intentionally unimplemented
//     }
// }


// Path: src/test/java/analyticalengine/main/MainTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import analyticalengine.TestUtils;

        // write a program that includes the file with baseName
        String withoutExtension = baseName.toString().replace(".ae", "");
        try (BufferedWriter writer = Files.newBufferedWriter(tempProgram,
                Charset.defaultCharset())) {
            writer.write("A include from library cards for "
                    + withoutExtension + "\n");
        }

        // list tempDir2 first, so we expect 28 as output
        String[] argv = new String[] { "-X", "-s", tempDir2 + ":" + tempDir1,
                tempProgram.toString() };
        Main.main(argv);
        String output = this.stdout.toString().toLowerCase();
        assertTrue(output.contains("28"));
        assertFalse(output.contains("6"));
    }

    /**
     * Test for listing the cards only.
     * 
     * @throws IOException
     *             If there is a problem reading from the test file.
     */
    @Test
    public void testList() throws IOException {
        Path testfile;
        try {
            testfile = Paths.get(this.getClass().getResource("/test_basic.ae")
                    .toURI());
        } catch (URISyntaxException e) {
            TestUtils.fail(e);