refactoring
diff --git a/src/test/java/TestUtil.java b/src/test/java/TestUtil.java
new file mode 100644
index 0000000..1fb3ce7
--- /dev/null
+++ b/src/test/java/TestUtil.java
@@ -0,0 +1,62 @@
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.utils.SqlBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 26/11/2015
+ */
+public class TestUtil {
+
+ @Test
+ public void testSqlBuilderSELECT () {
+ SqlBuilder b = new SqlBuilder("users");
+ b.select(Attributes.USERNAME, Attributes.PASSWORD).where(
+ Attributes.USERNAME + "=?");
+ Assert.assertEquals("query does not match",
+ "SELECT username, password FROM users WHERE username=?;",
+ b.toString());
+ }
+
+
+ @Test
+ public void testSqlBuilderINSERT () {
+ SqlBuilder b = new SqlBuilder("users");
+ b.insert(Attributes.USERNAME, Attributes.PASSWORD).params("user",
+ "pass");
+ Assert.assertEquals("query does not match",
+ "INSERT INTO users (username, password) VALUES (user, pass);",
+ b.toString());
+ }
+
+
+ @Test
+ public void testSqlBuilderINSERTExcludeWhere () {
+ SqlBuilder b = new SqlBuilder("users");
+ b.insert(Attributes.USERNAME, Attributes.PASSWORD)
+ .params("user", "pass").where("some=?");
+ Assert.assertEquals("query does not match",
+ "INSERT INTO users (username, password) VALUES (user, pass);",
+ b.toString());
+ }
+
+
+ @Test
+ public void testSqlBuilderDELETE () {
+ SqlBuilder b = new SqlBuilder("users");
+ b.delete().where(Attributes.PERSISTENT_ID + "=?");
+ Assert.assertEquals("query does not match",
+ "DELETE FROM users WHERE persistent_id=?;", b.toString());
+ }
+
+
+ @Test
+ public void testSqlBuilderUPDATE () {
+ SqlBuilder b = new SqlBuilder("users");
+ b.update(Attributes.USERNAME, Attributes.PASSWORD).params("user",
+ "pass");
+ Assert.assertEquals("query does not match",
+ "UPDATE users SET username=user, password=pass;", b.toString());
+ }
+}