package automatabuilder;
import StrategyPatternClasses.TableGenerator;
import interfaces.IAlphabet;
import interfaces.IShowDFA;
import interfaces.IState;
import interfaces.ITransition;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
/**
 * Created by oliv on 5/21/15.
 */
public class Test {
    Symbol a;
    Symbol b;
    Set<Symbol> symbols;
    List<ITransition> transList;
    IState q0;
    IAlphabet alphabet;

    @Before
    public void setup() {
        symbols = new HashSet<>();
        a = new Symbol("a");
        b = new Symbol("b");
        symbols.add(a);
        symbols.add(b);
        transList = new ArrayList<>();
        q0 = new State(transList, true, "q0");
        transList.add(new Transition(q0, a));
        transList.add(new Transition(q0, b));
        alphabet = new Alphabet(symbols);
    }

    @Test
    public void printTable() {
        List<IState> stateList = new LinkedList<>();
        stateList.add(q0);
        TableGenerator tb = new TableGenerator(stateList,alphabet,System.out);
        tb.generate();
        String result = "[ |a|b]\n[q0|a|b]\n";
    }
}

@@ -177,16 +177,35 @@
 nsition;
+%0A%0Aimport java.io.*;
 %0Aimport 
@@ -323,16 +323,22 @@
 c class 
+Output
 Test %7B%0A 
@@ -1080,68 +1080,1005 @@
     
-tb.generate();%0A        String result = %22%5B %7Ca%7Cb%5D%5Cn%5Bq0%7Ca%7Cb%5D%5Cn%22
+String result = %22%5B     %7C a %7C b %5D%5Cn%5B *q0 %7C a %7C b %5D%5Cn%22;%0A        File file = new File(%22./testfile%22);%0A        try %7B%0A            tb.changePrintStream(new PrintStream(file));%0A        %7D catch (FileNotFoundException e) %7B%0A            System.err.println(%22test went wrong%22);%0A            return;%0A        %7D%0A        tb.generate();%0A        StringBuilder sb = new StringBuilder();%0A        BufferedReader br;%0A        try %7B%0A             br = new BufferedReader(new FileReader(%22testfile%22));%0A        %7D catch (FileNotFoundException e ) %7B%0A            System.err.println(%22test went wrong%22);%0A            return;%0A        %7D%0A        Scanner sc = null;%0A        try %7B%0A            sc = new Scanner(file);%0A        %7D catch (FileNotFoundException e) %7B%0A            System.err.println(%22test went wrong%22);%0A            return;%0A        %7D%0A        while (sc.hasNext()) %7B%0A            sb.append(sc.nextLine());%0A            sb.append(%22%5Cn%22);%0A        %7D%0A        System.out.print(sb.toString());%0A        assertTrue(sb.toString().equals(result))
 ;%0A  

Add added test for table to file