// Path: library/src/main/java/uk/co/alt236/easycursor/EasyQueryModel.java
// public interface EasyQueryModel extends QueryModelInfo {
// 
//     /**
//      * Gets the user specified comment of this Model
//      *
//      * @return the comment
//      */
//     String getModelComment();
// 
//     /**
//      * Sets a comment on the model
//      *
//      * @param comment the comment to save
//      */
//     void setModelComment(String comment);
// 
//     /**
//      * Gets the user specified tag of this Model
//      *
//      * @return the tag
//      */
//     String getModelTag();
// 
//     /**
//      * Sets a tag on the model
//      *
//      * @param tag the tag to save
//      */
//     void setModelTag(String tag);
// 
//     /**
//      * Gets the user specified version of this Model
//      * The default value is 0
//      *
//      * @return the version of this model
//      */
//     int getModelVersion();
// 
//     /**
//      * Sets the model version
//      *
//      * @param version the version to save
//      */
//     void setModelVersion(int version);
// 
//     /**
//      * Will return the JSON representation of this QueryModel.
//      *
//      * @return the resulting JSON String
//      * @throws JSONException if there was an error creating the JSON
//      */
//     String toJson() throws JSONException;
// }


import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.Arrays;
import uk.co.alt236.easycursor.EasyQueryModel;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
        final String sql = "RAW_SQL";
        final String[] args = {"a", "b"};

        final RawQueryModel model = (RawQueryModel) new SqlQueryModel.RawQueryBuilder()
                .setModelComment(comment)
                .setModelTag(tag)
                .setModelVersion(version)
                .setSelectionArgs(args)
                .setRawSql(sql)
                .build();

        final String json = model.toJson();

        final RawQueryModel model2 = (RawQueryModel) SqlJsonModelConverter.convert(json);

        assertEquals(model.getModelComment(), model2.getModelComment());
        assertEquals(model.getModelTag(), model2.getModelTag());
        assertEquals(model.getModelVersion(), model2.getModelVersion());
        assertTrue(Arrays.equals(model.getSelectionArgs(), model2.getSelectionArgs()));
        assertEquals(model.getRawSql(), model2.getRawSql());
    }

    @Test
    public void testModelInfo() throws Exception {
        final String comment = "comment";
        final String tag = "tag";
        final int version = 22;
        final String sql = "RAW_SQL";
        final String[] args = {"a", "b"};

// Path: library/src/main/java/uk/co/alt236/easycursor/EasyQueryModel.java
// public interface EasyQueryModel extends QueryModelInfo {
// 
//     /**
//      * Gets the user specified comment of this Model
//      *
//      * @return the comment
//      */
//     String getModelComment();
// 
//     /**
//      * Sets a comment on the model
//      *
//      * @param comment the comment to save
//      */
//     void setModelComment(String comment);
// 
//     /**
//      * Gets the user specified tag of this Model
//      *
//      * @return the tag
//      */
//     String getModelTag();
// 
//     /**
//      * Sets a tag on the model
//      *
//      * @param tag the tag to save
//      */
//     void setModelTag(String tag);
// 
//     /**
//      * Gets the user specified version of this Model
//      * The default value is 0
//      *
//      * @return the version of this model
//      */
//     int getModelVersion();
// 
//     /**
//      * Sets the model version
//      *
//      * @param version the version to save
//      */
//     void setModelVersion(int version);
// 
//     /**
//      * Will return the JSON representation of this QueryModel.
//      *
//      * @return the resulting JSON String
//      * @throws JSONException if there was an error creating the JSON
//      */
//     String toJson() throws JSONException;
// }


// Path: library/src/test/java/uk/co/alt236/easycursor/sqlcursor/querymodels/RawQueryBuilderTest.java
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.Arrays;
import uk.co.alt236.easycursor.EasyQueryModel;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

        final String sql = "RAW_SQL";
        final String[] args = {"a", "b"};

        final RawQueryModel model = (RawQueryModel) new SqlQueryModel.RawQueryBuilder()
                .setModelComment(comment)
                .setModelTag(tag)
                .setModelVersion(version)
                .setSelectionArgs(args)
                .setRawSql(sql)
                .build();

        final String json = model.toJson();

        final RawQueryModel model2 = (RawQueryModel) SqlJsonModelConverter.convert(json);

        assertEquals(model.getModelComment(), model2.getModelComment());
        assertEquals(model.getModelTag(), model2.getModelTag());
        assertEquals(model.getModelVersion(), model2.getModelVersion());
        assertTrue(Arrays.equals(model.getSelectionArgs(), model2.getSelectionArgs()));
        assertEquals(model.getRawSql(), model2.getRawSql());
    }

    @Test
    public void testModelInfo() throws Exception {
        final String comment = "comment";
        final String tag = "tag";
        final int version = 22;
        final String sql = "RAW_SQL";
        final String[] args = {"a", "b"};

        final EasyQueryModel model = new SqlQueryModel.RawQueryBuilder()