Use the migrated injected setting code in settingslib.

Manual merge to master from pi-car-dev
Bug: 68198078
Test: Tested on device
Change-Id: Iff767cd6bf7408b45ce9594628d3fd0a71744e9f
This commit is contained in:
Aarthi Balachander
2018-07-10 17:04:53 -07:00
parent cc65fbba9d
commit d0f835981c
4 changed files with 29 additions and 750 deletions

View File

@@ -1,59 +0,0 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.location;
import static com.google.common.truth.Truth.assertThat;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SettingsRobolectricTestRunner.class)
public final class InjectedSettingTest {
private static final String TEST_STRING = "test";
@Test
public void buildWithoutPackageName_ShouldReturnNull() {
assertThat(((new InjectedSetting.Builder())
.setClassName(TEST_STRING)
.setTitle(TEST_STRING)
.setSettingsActivity(TEST_STRING).build())).isNull();
}
private InjectedSetting getTestSetting() {
return new InjectedSetting.Builder()
.setPackageName(TEST_STRING)
.setClassName(TEST_STRING)
.setTitle(TEST_STRING)
.setSettingsActivity(TEST_STRING).build();
}
@Test
public void testEquals() {
InjectedSetting setting1 = getTestSetting();
InjectedSetting setting2 = getTestSetting();
assertThat(setting1).isEqualTo(setting2);
}
@Test
public void testHashCode() {
InjectedSetting setting = getTestSetting();
assertThat(setting.hashCode()).isEqualTo(1225314048);
}
}