package org.hisp.dhis.android.core.arch.db;

import org.junit.Test;

import static org.assertj.core.api.Java6Assertions.assertThat;

public class WhereClauseBuilderShould {

    @Test
    public void build_where_statement_for_one_key_value_pair_with_string_value() {
        WhereClauseBuilder builder = new WhereClauseBuilder();
        String whereStatement = builder
                .appendKeyStringValue("COL", "VAL")
                .build();
        assertThat(whereStatement).isEqualTo("COL = 'VAL'");
    }

    @Test
    public void build_where_statement_for_one_key_value_pair_with_int_value() {
        WhereClauseBuilder builder = new WhereClauseBuilder();
        String whereStatement = builder
                .appendKeyNumberValue("COL", 2)
                .build();
        assertThat(whereStatement).isEqualTo("COL = 2");
    }

    @Test
    public void build_where_statement_for_two_key_value_pairs() {
        WhereClauseBuilder builder = new WhereClauseBuilder();
        String whereStatement = builder
                .appendKeyStringValue("COL1", "VAL1")
                .appendKeyStringValue("COL2", "VAL2")
                .build();
        assertThat(whereStatement).isEqualTo("COL1 = 'VAL1' AND COL2 = 'VAL2'");
    }

    @Test(expected = RuntimeException.class)
    public void throw_exception_for_no_pairs() {
        WhereClauseBuilder builder = new WhereClauseBuilder();
        builder.build();
    }
}
@@ -38,16 +38,52 @@
 ch.db;%0A%0A
+import org.assertj.core.util.Lists;%0A
 import o
@@ -1269,32 +1269,773 @@
 VAL2'%22);%0A    %7D%0A%0A
+    @Test%0A    public void build_where_statement_for_not_in_key_values() %7B%0A        WhereClauseBuilder builder = new WhereClauseBuilder();%0A        String whereStatement = builder%0A                .appendNotInKeyStringValues(%22COL1%22, Lists.newArrayList(%22VAL1%22, %22VAL2%22))%0A                .build();%0A        assertThat(whereStatement).isEqualTo(%22COL1 NOT IN ('VAL1', 'VAL2')%22);%0A    %7D%0A%0A    @Test%0A    public void build_where_statement_for_in_key_values() %7B%0A        WhereClauseBuilder builder = new WhereClauseBuilder();%0A        String whereStatement = builder%0A                .appendInKeyStringValues(%22COL1%22, Lists.newArrayList(%22VAL1%22, %22VAL2%22))%0A                .build();%0A        assertThat(whereStatement).isEqualTo(%22COL1 IN ('VAL1', 'VAL2')%22);%0A    %7D%0A%0A
     @Test(expect

Add WhereClauseBuilderShould tests