import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

/**
 * User: Johannes Krampf <johkra@gmail.com>
 * Date: 27.02.11
 */
public class QueryTest {
    private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();

    @Before
    public void setUp() throws Exception {
        System.setOut(new PrintStream(outContent));
    }

    @Test
    public void testSimpleQuery() throws Exception {
        String commands = "boy(bill)\n" +
                "boy(bill)?";
        byte[] bytes = commands.getBytes("utf-8");
        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
        Prolog.procFile(input,"");
        assertEquals("Yes\n", outContent.toString());
    }

    @Test
    public void testVariableQuery() throws Exception {
        String commands = "boy(X)?";
        byte[] bytes = commands.getBytes("utf-8");
        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
        Prolog.procFile(input, "");
        assertEquals("{X=bill}\n", outContent.toString());
    }

    @Test
    public void testIndirectQuery() throws Exception {
        String commands = "mother(alice,bill)\n" +
                "child(J,K) :- mother(K,J)\n" +
                "son(X,Y) :- child(X,Y),boy(X)\n" +
                "son(X,alice)?";
        byte[] bytes = commands.getBytes("utf-8");
        ByteArrayInputStream input = new ByteArrayInputStream(bytes);
        Prolog.procFile(input, "");
        assertEquals("{X=bill}\n", outContent.toString());
    }

    @After
    public void tearDown() throws Exception {
        System.setOut(null);
    }
}

@@ -1686,24 +1686,965 @@
 ());%0A    %7D%0A%0A
+    @Test%0A    public void testMember() throws Exception %7B%0A       String commands = %22member(X,%5BX%7CT%5D)%5Cn%22 +%0A               %22member(X,%5BH%7CT%5D) :- member(X,T)%5Cn%22 +%0A               %22member(a,%5Ba,b,c%5D)?%5Cn%22 +%0A               %22member(b,%5Ba,b,c%5D)?%5Cn%22 +%0A               %22member(c,%5Ba,b,c%5D)?%22;%0A        byte%5B%5D bytes = commands.getBytes(%22utf-8%22);%0A        ByteArrayInputStream input = new ByteArrayInputStream(bytes);%0A        Prolog.procFile(input, %22%22);%0A        assertEquals(%22Yes%5CnYes%5CnYes%5Cn%22, outContent.toString());%0A    %7D%0A%0A        @Test%0A    public void testAppend() throws Exception %7B%0A       String commands = %22append(%5B%5D,L,L)%5Cn%22 +%0A               %22append(%5BX%7CA%5D,B,%5BX%7CC%5D) :- append(A,B,C)%5Cn%22 +%0A               %22append(%5Ba,b%5D,%5Bc,d%5D,X)?%22;%0A        byte%5B%5D bytes = commands.getBytes(%22utf-8%22);%0A        ByteArrayInputStream input = new ByteArrayInputStream(bytes);%0A        Prolog.procFile(input, %22%22);%0A        assertEquals(%22%7BX=%5Ba,b,c,d%5D%7D%5Cn%22, outContent.toString());%0A    %7D%0A%0A%0A%0A
     @After%0A 

Add test for list operations