// 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 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.assertEquals;
import static org.junit.Assert.assertTrue;
                .setProjectionIn(projectionIn)
                .setSortOrder("sortorder")
                .setStrict(true)
                .setTables("tables")
                .setSelection("selection")
                .setSelectionArgs(selectionArgs)
                .build();

        final String json = model.toJson();
        final SelectQueryModel model2 = (SelectQueryModel) SqlJsonModelConverter.convert(json);

        assertEquals(model.isDistinct(), model2.isDistinct());
        assertEquals(model.getGroupBy(), model2.getGroupBy());
        assertEquals(model.getHaving(), model2.getHaving());
        assertEquals(model.getLimit(), model2.getLimit());
        assertTrue(Arrays.equals(model.getProjectionIn(), model2.getProjectionIn()));
        assertEquals(model.getSortOrder(), model2.getSortOrder());
        assertEquals(model.isStrict(), model2.isStrict());
        assertEquals(model.getTables(), model2.getTables());
        assertEquals(model.getSelection(), model2.getSelection());
        assertTrue(Arrays.equals(model.getSelectionArgs(), model2.getSelectionArgs()));
    }

    @Test
    public void testModelInfo() {
        final String comment = "comment";
        final String tag = "tag";
        final int version = 22;
        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/SelectQueryBuilderTest.java
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.assertEquals;
import static org.junit.Assert.assertTrue;

                .setProjectionIn(projectionIn)
                .setSortOrder("sortorder")
                .setStrict(true)
                .setTables("tables")
                .setSelection("selection")
                .setSelectionArgs(selectionArgs)
                .build();

        final String json = model.toJson();
        final SelectQueryModel model2 = (SelectQueryModel) SqlJsonModelConverter.convert(json);

        assertEquals(model.isDistinct(), model2.isDistinct());
        assertEquals(model.getGroupBy(), model2.getGroupBy());
        assertEquals(model.getHaving(), model2.getHaving());
        assertEquals(model.getLimit(), model2.getLimit());
        assertTrue(Arrays.equals(model.getProjectionIn(), model2.getProjectionIn()));
        assertEquals(model.getSortOrder(), model2.getSortOrder());
        assertEquals(model.isStrict(), model2.isStrict());
        assertEquals(model.getTables(), model2.getTables());
        assertEquals(model.getSelection(), model2.getSelection());
        assertTrue(Arrays.equals(model.getSelectionArgs(), model2.getSelectionArgs()));
    }

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

        final EasyQueryModel model = new SqlQueryModel.SelectQueryBuilder()