/*
 * Copyright (c) 2004-2019, University of Oslo
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * Neither the name of the HISP project nor the names of its contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.hisp.dhis.android.testapp.category;

import org.hisp.dhis.android.core.category.CategoryOptionCombo;
import org.hisp.dhis.android.core.data.database.SyncedDatabaseMockIntegrationShould;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;

import androidx.test.runner.AndroidJUnit4;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

@RunWith(AndroidJUnit4.class)
public class CategoryOptionComboCollectionRepositoryMockIntegrationShould extends SyncedDatabaseMockIntegrationShould {

    @Test
    public void find_all() {
        List<CategoryOptionCombo> categoryOptionCombos = d2.categoryModule().categoryOptionCombos.get();
        assertThat(categoryOptionCombos.size(), is(3));
    }

    @Test
    public void filter_by_category_combo_A() {
        List<CategoryOptionCombo> categoryOptionCombos = d2.categoryModule().categoryOptionCombos
                .byCategoryComboUid().eq("m2jTvAj5kkm")
                .get();
        assertThat(categoryOptionCombos.size(), is(1));
    }

    @Test
    public void filter_by_category_combo_B() {
        List<CategoryOptionCombo> categoryOptionCombos = d2.categoryModule().categoryOptionCombos
                .byCategoryComboUid().eq("p0KPaWEg3cf")
                .get();
        assertThat(categoryOptionCombos.size(), is(2));
    }

    @Test
    public void include_category_options_as_children() {
        CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos
                .withCategoryOptions().one().get();
        assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU"));
    }

    @Test
    public void include_category_options_as_children_in_collection_repository_when_all_selected() {
        CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos
                .withAllChildren().get().get(0);
        assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU"));
    }

    @Test
    public void include_category_options_as_children_in_object_repository_when_all_selected() {
        CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos
                .one().withAllChildren().get();
        assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU"));
    }
}
@@ -1600,16 +1600,57 @@
 egory;%0A%0A
+import com.google.common.collect.Lists;%0A%0A
 import o
@@ -1705,16 +1705,16 @@
 nCombo;%0A
-
 import o
@@ -2295,16 +2295,55 @@
 onCombos
+%0A                .withCategoryOptions()
 .get();%0A
@@ -2930,32 +2930,32 @@
         .get();%0A
-
         assertTh
@@ -2993,32 +2993,1392 @@
  is(2));%0A    %7D%0A%0A
+    @Test%0A    public void filter_by_category_option() %7B%0A        List%3CCategoryOptionCombo%3E categoryOptionCombos = d2.categoryModule().categoryOptionCombos%0A                .byCategoryOptions(Lists.newArrayList(%22as6ygGvUGNg%22))%0A                .get();%0A        assertThat(categoryOptionCombos.size(), is(1));%0A    %7D%0A%0A    @Test%0A    public void filter_by_category_option_list() %7B%0A        List%3CCategoryOptionCombo%3E categoryOptionCombos = d2.categoryModule().categoryOptionCombos%0A                .byCategoryOptions(Lists.newArrayList(%22Fp4gVHbRvEV%22, %22uZUnebiT5DI%22))%0A                .get();%0A        assertThat(categoryOptionCombos.size(), is(1));%0A    %7D%0A%0A    @Test%0A    public void not_find_combos_when_filter_by_less_options_than_they_have() %7B%0A        List%3CCategoryOptionCombo%3E categoryOptionCombos = d2.categoryModule().categoryOptionCombos%0A                .byCategoryOptions(Lists.newArrayList(%22Fp4gVHbRvEV%22))%0A                .get();%0A        assertThat(categoryOptionCombos.size(), is(0));%0A    %7D%0A%0A    @Test%0A    public void not_find_combos_when_filter_by_more_options_than_they_have() %7B%0A        List%3CCategoryOptionCombo%3E categoryOptionCombos = d2.categoryModule().categoryOptionCombos%0A                .byCategoryOptions(Lists.newArrayList(%22as6ygGvUGNg%22, %22Fp4gVHbRvEV%22, %22uZUnebiT5DI%22))%0A                .get();%0A        assertThat(categoryOptionCombos.size(), is(0));%0A    %7D%0A%0A
     @Test%0A    pu

Add CategoryOptionComboCollectionRepositoryMockIntegrationShould tests