1/*
2 * Copyright 2017 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 androidx.recyclerview.selection;
18
19import static org.junit.Assert.assertEquals;
20
21import android.os.Bundle;
22import android.support.test.filters.SmallTest;
23import android.support.test.runner.AndroidJUnit4;
24
25import androidx.recyclerview.selection.testing.Bundles;
26
27import org.junit.Before;
28import org.junit.Test;
29import org.junit.runner.RunWith;
30
31@RunWith(AndroidJUnit4.class)
32@SmallTest
33public final class StorageStrategy_StringTest {
34
35    private StorageStrategy<String> mStorage;
36
37    @Before
38    public void setUp() {
39        mStorage = StorageStrategy.createStringStorage();
40    }
41
42    @Test
43    public void testReadWrite() {
44        MutableSelection<String> orig = new MutableSelection<>();
45        orig.add("5");
46        orig.add("10");
47        orig.add("15");
48
49        Bundle parceled = Bundles.forceParceling(mStorage.asBundle(orig));
50        Selection<String> restored = mStorage.asSelection(parceled);
51
52        assertEquals(orig, restored);
53    }
54}
55