Skip to content

Commit c4bee0c

Browse files
committed
Add unit tests for the new registrars.
1 parent c339aa0 commit c4bee0c

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.appcheck.debug.testing;
16+
17+
import static com.google.common.truth.Truth.assertThat;
18+
19+
import com.google.firebase.components.Component;
20+
import java.util.List;
21+
import org.junit.Test;
22+
import org.junit.runner.RunWith;
23+
import org.robolectric.RobolectricTestRunner;
24+
25+
/** Tests for {@link FirebaseAppCheckDebugTestingRegistrar}. */
26+
@RunWith(RobolectricTestRunner.class)
27+
public class FirebaseAppCheckDebugTestingRegistrarTest {
28+
@Test
29+
public void testGetComponents() {
30+
FirebaseAppCheckDebugTestingRegistrar registrar = new FirebaseAppCheckDebugTestingRegistrar();
31+
List<Component<?>> components = registrar.getComponents();
32+
assertThat(components).isNotEmpty();
33+
assertThat(components).hasSize(2);
34+
Component<?> appCheckDebugTestingComponent = components.get(0);
35+
assertThat(appCheckDebugTestingComponent.getDependencies()).isEmpty();
36+
assertThat(appCheckDebugTestingComponent.isLazy()).isTrue();
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.appcheck.debug;
16+
17+
import static com.google.common.truth.Truth.assertThat;
18+
19+
import com.google.firebase.FirebaseApp;
20+
import com.google.firebase.components.Component;
21+
import com.google.firebase.components.Dependency;
22+
import java.util.List;
23+
import org.junit.Test;
24+
import org.junit.runner.RunWith;
25+
import org.robolectric.RobolectricTestRunner;
26+
27+
/** Tests for {@link FirebaseAppCheckDebugRegistrar}. */
28+
@RunWith(RobolectricTestRunner.class)
29+
public class FirebaseAppCheckDebugRegistrarTest {
30+
@Test
31+
public void testGetComponents() {
32+
FirebaseAppCheckDebugRegistrar registrar = new FirebaseAppCheckDebugRegistrar();
33+
List<Component<?>> components = registrar.getComponents();
34+
assertThat(components).isNotEmpty();
35+
assertThat(components).hasSize(2);
36+
Component<?> appCheckDebugComponent = components.get(0);
37+
assertThat(appCheckDebugComponent.getDependencies())
38+
.containsExactly(
39+
Dependency.required(FirebaseApp.class),
40+
Dependency.optionalProvider(InternalDebugSecretProvider.class));
41+
assertThat(appCheckDebugComponent.isLazy()).isTrue();
42+
}
43+
}

0 commit comments

Comments
 (0)