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 android.support.mediacompat.testlib.util;
18
19import static org.junit.Assert.assertEquals;
20import static org.junit.Assert.assertSame;
21
22import android.os.Bundle;
23
24/**
25 * Utility methods used for testing.
26 */
27public final class TestUtil {
28
29    /**
30     * Asserts that two Bundles are equal.
31     */
32    public static void assertBundleEquals(Bundle expected, Bundle observed) {
33        if (expected == null || observed == null) {
34            assertSame(expected, observed);
35        }
36        assertEquals(expected.size(), observed.size());
37        for (String key : expected.keySet()) {
38            assertEquals(expected.get(key), observed.get(key));
39        }
40    }
41
42    private TestUtil() {
43    }
44}
45