-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instrumentation registry changes (#516)
* Moving AndroidInstrumentationRegistryImpl to an internal package * Removing register method from AndroidInstrumentationServices * Updating tests * Updating docs * Updating docs * Convenience method AndroidInstrumentationServices.getService * Renaming AndroidInstrumentationServicesImpl.register to registerForTest * Renaming AndroidInstrumentationServices to AndroidInstrumentationLoader * Renaming vars * Renaming AndroidInstrumentationLoader.Companion.getInstrumentation
- Loading branch information
1 parent
c2dee01
commit 76d461b
Showing
9 changed files
with
89 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
...t/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.android.internal.instrumentation | ||
|
||
import io.mockk.mockk | ||
import io.opentelemetry.android.instrumentation.TestAndroidInstrumentation | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
|
||
class AndroidInstrumentationLoaderImplTest { | ||
private lateinit var loader: AndroidInstrumentationLoaderImpl | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
loader = AndroidInstrumentationLoaderImpl() | ||
} | ||
|
||
@Test | ||
fun `Find implementations available in the classpath when querying an instrumentation`() { | ||
val instrumentation = loader.getByType(TestAndroidInstrumentation::class.java)!! | ||
|
||
assertThat(instrumentation.installed).isFalse() | ||
|
||
instrumentation.install(mockk(), mockk()) | ||
|
||
assertThat(loader.getByType(TestAndroidInstrumentation::class.java)!!.installed).isTrue() | ||
} | ||
|
||
@Test | ||
fun `Find implementations available in the classpath when querying all instrumentations`() { | ||
val instrumentations = loader.getAll() | ||
|
||
assertThat(instrumentations).hasSize(1) | ||
assertThat(instrumentations.first()).isInstanceOf(TestAndroidInstrumentation::class.java) | ||
} | ||
} |