blob: 4ccae9380a583928bb6f578423d16295f5ba05ff [file] [log] [blame]
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -07001/*
2 * Copyright (C) 2018 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 com.example.android.systemupdatersample.util;
18
19import static org.junit.Assert.assertArrayEquals;
20
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070021import android.support.test.filters.SmallTest;
22import android.support.test.runner.AndroidJUnit4;
23
24import com.example.android.systemupdatersample.UpdateConfig;
25
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070026import org.junit.Rule;
27import org.junit.Test;
28import org.junit.rules.ExpectedException;
29import org.junit.runner.RunWith;
30
31import java.util.Arrays;
32import java.util.List;
33
34/**
35 * Tests for {@link UpdateConfigs}
36 */
37@RunWith(AndroidJUnit4.class)
38@SmallTest
39public class UpdateConfigsTest {
40
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070041 @Rule
42 public final ExpectedException thrown = ExpectedException.none();
43
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070044 @Test
45 public void configsToNames_extractsNames() {
46 List<UpdateConfig> configs = Arrays.asList(
Zhomart Mukhamejanov963e3ee2018-04-26 21:07:05 -070047 new UpdateConfig("blah", "http://", UpdateConfig.AB_INSTALL_TYPE_NON_STREAMING),
48 new UpdateConfig("blah 2", "http://", UpdateConfig.AB_INSTALL_TYPE_STREAMING)
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070049 );
50 String[] names = UpdateConfigs.configsToNames(configs);
51 assertArrayEquals(new String[] {"blah", "blah 2"}, names);
52 }
53}