blob: 443183eeba4de5b49ab28e491d666c974ecf367e [file] [log] [blame]
Makoto Onukiff94e032017-08-08 14:58:19 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package com.android.internal.util;
17
18import android.test.AndroidTestCase;
19import android.test.suitebuilder.annotation.SmallTest;
20
21@SmallTest
22public class ObjectUtilsTest extends AndroidTestCase {
23 public void testCompare() {
24 assertEquals(0, ObjectUtils.compare(null, null));
25 assertEquals(1, ObjectUtils.compare("a", null));
26 assertEquals(-1, ObjectUtils.compare(null, "a"));
27
28 assertEquals(0, ObjectUtils.compare("a", "a"));
29
30 assertEquals(-1, ObjectUtils.compare("a", "b"));
31 assertEquals(1, ObjectUtils.compare("b", "a"));
32 }
33}