@@ -0,0 +1,2001 @@
+package org.matrix.androidsdk.lazyloading;%0A%0Aimport android.support.test.InstrumentationRegistry;%0A%0Aimport junit.framework.Assert;%0A%0Aimport org.junit.BeforeClass;%0Aimport org.junit.FixMethodOrder;%0Aimport org.junit.Test;%0Aimport org.junit.runners.MethodSorters;%0Aimport org.matrix.androidsdk.RestClient;%0Aimport org.matrix.androidsdk.common.CommonTestHelper;%0Aimport org.matrix.androidsdk.common.TestApiCallback;%0Aimport org.matrix.androidsdk.rest.model.search.SearchResponse;%0A%0Aimport java.util.Collections;%0Aimport java.util.concurrent.CountDownLatch;%0A%0A@FixMethodOrder(MethodSorters.JVM)%0Apublic class SearchTest %7B%0A%0A    private CommonTestHelper mTestHelper = new CommonTestHelper();%0A    private LazyLoadingTestHelper mLazyLoadingTestHelper = new LazyLoadingTestHelper(mTestHelper);%0A%0A    @BeforeClass%0A    public static void init() %7B%0A        RestClient.initUserAgent(InstrumentationRegistry.getContext());%0A    %7D%0A%0A    @Test%0A    public void Search_CheckMessageSearch_LazyLoadedMembers() throws Exception %7B%0A        Search_CheckMessageSearch_(true);%0A    %7D%0A%0A    @Test%0A    public void Search_CheckMessageSearch_LoadAllMembers() throws Exception %7B%0A        Search_CheckMessageSearch_(false);%0A    %7D%0A%0A    private void Search_CheckMessageSearch_(boolean withLazyLoading) throws Exception %7B%0A        final LazyLoadingScenarioData data = mLazyLoadingTestHelper.createScenario(withLazyLoading);%0A        final CountDownLatch lock = new CountDownLatch(1);%0A        data.aliceSession.pauseEventStream();%0A        data.aliceSession.resumeEventStream();%0A        data.aliceSession.getDataHandler().clear();%0A        data.aliceSession.searchMessageText(%22Bob message%22, Collections.singletonList(data.roomId), 0, 0, null, new TestApiCallback%3CSearchResponse%3E(lock) %7B%0A            @Override%0A            public void onSuccess(SearchResponse info) %7B%0A                Assert.assertEquals(1, info.searchCategories.roomEvents.results.size());%0A                super.onSuccess(info);%0A            %7D%0A        %7D);%0A        mTestHelper.await(lock);%0A    %7D%0A%0A%7D%0A

Test lazyloading : Add search test