// Path: soap-server/src/main/java/com/cookbook/tutorial/internal/dsql/Constants.java
// public class Constants {
//     public static final String INGREDIENT = "INGREDIENT";
//     public static final String RECIPE = "RECIPE";
//     public static final String ALL = "ALL";
// }


import com.cookbook.tutorial.internal.dsql.*;
import com.cookbook.tutorial.internal.dsql.Constants;
import org.junit.Before;
import org.junit.Test;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParseTreeUtils;
import org.parboiled.support.ParsingResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.*;
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Foo is not a valid Entity Type", result.hasErrors());
    }

    @Test
    public void validInvalidFieldExpression(){
        String input = "GET foo FROM INGREDIENT";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertTrue("foo is not a valid field", result.hasErrors());
    }

    @Test
    public void validWhereExpression(){
        String input = "GET name FROM INGREDIENT MATCHING id==1";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Fail to process query", result.hasErrors());
    }

    @Test
    public void validWhereExpressionContains(){
        String input = "GET ALL FROM RECIPE MATCHING id contains 1";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Fail to process query", result.hasErrors());
    }

    @Test
    public void getBasicQuery(){
        String input = "GET ALL FROM INGREDIENT";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        Dsql dsql = Dsql.newInstance(input);
// Path: soap-server/src/main/java/com/cookbook/tutorial/internal/dsql/Constants.java
// public class Constants {
//     public static final String INGREDIENT = "INGREDIENT";
//     public static final String RECIPE = "RECIPE";
//     public static final String ALL = "ALL";
// }


// Path: soap-server/src/test/java/com/cookbook/tutorial/service/DsqlParserTest.java
import com.cookbook.tutorial.internal.dsql.*;
import com.cookbook.tutorial.internal.dsql.Constants;
import org.junit.Before;
import org.junit.Test;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParseTreeUtils;
import org.parboiled.support.ParsingResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.*;

        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Foo is not a valid Entity Type", result.hasErrors());
    }

    @Test
    public void validInvalidFieldExpression(){
        String input = "GET foo FROM INGREDIENT";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertTrue("foo is not a valid field", result.hasErrors());
    }

    @Test
    public void validWhereExpression(){
        String input = "GET name FROM INGREDIENT MATCHING id==1";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Fail to process query", result.hasErrors());
    }

    @Test
    public void validWhereExpressionContains(){
        String input = "GET ALL FROM RECIPE MATCHING id contains 1";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        assertFalse("Fail to process query", result.hasErrors());
    }

    @Test
    public void getBasicQuery(){
        String input = "GET ALL FROM INGREDIENT";
        ParsingResult<?> result = new ReportingParseRunner(parser.Statement()).run(input);
        Dsql dsql = Dsql.newInstance(input);
        assertEquals(Constants.INGREDIENT,dsql.getEntity());