blob: 321a7f21c3078bf9705785755b5180664b0b3bd2 [file] [log] [blame]
Tony Makb393eea2019-07-05 15:23:39 +01001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package android.view.textclassifier.logging;
18
19import androidx.test.ext.junit.runners.AndroidJUnit4;
20import androidx.test.filters.SmallTest;
21
22import com.google.common.truth.Truth;
23import org.junit.Test;
24import org.junit.runner.RunWith;
25
26@SmallTest
27@RunWith(AndroidJUnit4.class)
28public class SmartSelectionEventTrackerTest {
29
30 @Test
31 public void getVersionInfo_valid() {
32 String signature = "a|702|b";
33 String versionInfo = SmartSelectionEventTracker.SelectionEvent.getVersionInfo(signature);
34 Truth.assertThat(versionInfo).isEqualTo("702");
35 }
36
37 @Test
38 public void getVersionInfo_invalid() {
39 String signature = "|702";
40 String versionInfo = SmartSelectionEventTracker.SelectionEvent.getVersionInfo(signature);
41 Truth.assertThat(versionInfo).isEmpty();
42 }
43}