@@ -0,0 +1,2872 @@
+/*%0A * Copyright 2021 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage androidx.appsearch.app.cts;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0A%0Aimport androidx.appsearch.app.SearchResult;%0Aimport androidx.appsearch.app.util.AppSearchEmail;%0A%0Aimport org.junit.Test;%0A%0Apublic class SearchResultCtsTest %7B%0A%0A    @Test%0A    public void testBuildSearchResult() %7B%0A        SearchResult.MatchRange exactMatchRange = new SearchResult.MatchRange(3, 8);%0A        SearchResult.MatchRange snippetMatchRange = new SearchResult.MatchRange(1, 10);%0A        SearchResult.MatchInfo matchInfo =%0A                new SearchResult.MatchInfo.Builder(%22body%22)%0A                        .setExactMatchRange(exactMatchRange)%0A                        .setSnippetRange(snippetMatchRange).build();%0A%0A        AppSearchEmail email = new AppSearchEmail.Builder(%22namespace1%22, %22id1%22)%0A                .setBody(%22Hello World.%22)%0A                .build();%0A        SearchResult searchResult = new SearchResult.Builder(%22packageName%22, %22databaseName%22)%0A                .setGenericDocument(email)%0A                .addMatchInfo(matchInfo)%0A                .setRankingSignal(2.9)%0A                .build();%0A%0A        assertThat(searchResult.getPackageName()).isEqualTo(%22packageName%22);%0A        assertThat(searchResult.getDatabaseName()).isEqualTo(%22databaseName%22);%0A        assertThat(searchResult.getRankingSignal()).isEqualTo(2.9);%0A        assertThat(searchResult.getGenericDocument()).isEqualTo(email);%0A        assertThat(searchResult.getMatchInfos()).hasSize(1);%0A        SearchResult.MatchInfo actualMatchInfo = searchResult.getMatchInfos().get(0);%0A        assertThat(actualMatchInfo.getPropertyPath()).isEqualTo(%22body%22);%0A        assertThat(actualMatchInfo.getExactMatchRange()).isEqualTo(exactMatchRange);%0A        assertThat(actualMatchInfo.getSnippetRange()).isEqualTo(snippetMatchRange);%0A        assertThat(actualMatchInfo.getExactMatch()).isEqualTo(%22lo Wo%22);%0A        assertThat(actualMatchInfo.getSnippet()).isEqualTo(%22ello Worl%22);%0A        assertThat(actualMatchInfo.getFullText()).isEqualTo(%22Hello World.%22);%0A    %7D%0A%0A    @Test%0A    public void testMatchRange() %7B%0A        SearchResult.MatchRange matchRange = new SearchResult.MatchRange(13, 47);%0A        assertThat(matchRange.getStart()).isEqualTo(13);%0A        assertThat(matchRange.getEnd()).isEqualTo(47);%0A    %7D%0A%7D%0A

Add cts test for SearchResult, MatchInfo and MatchRange