class TaintFrame extends Frame<Taint> {

    public String toString(MethodGen method) {
        String[] variables = new String[method.getLocalVariables().length];
        LocalVariableGen[] variablesGen = method.getLocalVariables();
        for(int i=0; i<variablesGen.length ;i++) {
            variables[i] = variablesGen[i].getName();
        }
        return toString(variables);
    }

}

class TaintFrameTest {

    @Test
    public void validateSimpleTaintFrameWithLocal() {


        TaintFrame frame = new TaintFrame(4);
        frame.setValue(0, new Taint(Taint.State.TAINTED));
        frame.setValue(1, new Taint(Taint.State.TAINTED));
        frame.setValue(2, new Taint(Taint.State.UNKNOWN));
        frame.setValue(3, new Taint(Taint.State.UNKNOWN));
        frame.pushValue(new Taint(Taint.State.TAINTED));
        frame.pushValue(new Taint(Taint.State.UNKNOWN));
        frame.pushValue(new Taint(Taint.State.NULL));
        frame.pushValue(new Taint(Taint.State.SAFE));

        String[] variables = new String[] {"safe","null_value","external","modifyMe"};
        String debugOutput = frame.toString(variables);
        System.out.println(debugOutput);
        assertTrue(debugOutput.contains("0. SAFE {S}"));
        assertTrue(debugOutput.contains("1. NULL {N}"));
        assertTrue(debugOutput.contains("2. UNKNOWN {U}"));
        assertTrue(debugOutput.contains("3. TAINTED {T}"));

        for(String variable : variables) {
            assertTrue(debugOutput.contains("| "+variable));
        }
    }

}