Skip to content

Commit

Permalink
Renamed TypeLocator to PoolStrategy in order to normalize the namings.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Aug 23, 2016
1 parent b209ec2 commit a33f3b9
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 171 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Expand Up @@ -71,7 +71,7 @@ public class AgentBuilderDefaultTest {
private AgentBuilder.Transformer transformer; private AgentBuilder.Transformer transformer;


@Mock @Mock
private AgentBuilder.TypeLocator typeLocator; private AgentBuilder.PoolStrategy poolStrategy;


@Mock @Mock
private AgentBuilder.TypeStrategy typeStrategy; private AgentBuilder.TypeStrategy typeStrategy;
Expand Down Expand Up @@ -114,7 +114,7 @@ public void setUp() throws Exception {
when(dynamicType.getLoadedTypeInitializers()).thenReturn(loadedTypeInitializers); when(dynamicType.getLoadedTypeInitializers()).thenReturn(loadedTypeInitializers);
when(dynamicType.getBytes()).thenReturn(BAZ); when(dynamicType.getBytes()).thenReturn(BAZ);
when(transformer.transform(builder, new TypeDescription.ForLoadedType(REDEFINED), REDEFINED.getClassLoader())).thenReturn((DynamicType.Builder) builder); when(transformer.transform(builder, new TypeDescription.ForLoadedType(REDEFINED), REDEFINED.getClassLoader())).thenReturn((DynamicType.Builder) builder);
when(typeLocator.typePool(any(ClassFileLocator.class), any(ClassLoader.class))).thenReturn(typePool); when(poolStrategy.typePool(any(ClassFileLocator.class), any(ClassLoader.class))).thenReturn(typePool);
when(typePool.describe(REDEFINED.getName())).thenReturn(resolution); when(typePool.describe(REDEFINED.getName())).thenReturn(resolution);
when(instrumentation.getAllLoadedClasses()).thenReturn(new Class<?>[]{REDEFINED}); when(instrumentation.getAllLoadedClasses()).thenReturn(new Class<?>[]{REDEFINED});
when(initializationStrategy.dispatcher()).thenReturn(dispatcher); when(initializationStrategy.dispatcher()).thenReturn(dispatcher);
Expand All @@ -135,7 +135,7 @@ public void testSuccessfulWithoutExistingClass() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -174,7 +174,7 @@ public void testSuccessfulWithoutExistingClassConjunction() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -209,7 +209,7 @@ public void testSuccessfulWithoutExistingClassDisjunction() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -243,7 +243,7 @@ public void testSuccessfulWithExistingClass() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -278,7 +278,7 @@ public void testSuccessfulWithRetransformationMatched() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -310,7 +310,7 @@ public void testSkipRetransformationWithNonRedefinable() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -341,7 +341,7 @@ public void testSkipRetransformationWithNonMatched() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -375,7 +375,7 @@ public void testSkipRetransformationWithNonMatchedListenerException() throws Exc
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -409,7 +409,7 @@ public void testSkipRetransformationWithNonMatchedListenerCompleteException() th
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -442,7 +442,7 @@ public void testSuccessfulWithRetransformationMatchedChunked() throws Exception
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION_CHUNKED) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION_CHUNKED)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -478,7 +478,7 @@ public void testRetransformationChunkedOneFails() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION_CHUNKED) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION_CHUNKED)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -508,7 +508,7 @@ public void testRetransformationNotSupported() throws Exception {
new AgentBuilder.Default(byteBuddy) new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -526,7 +526,7 @@ public void testSuccessfulWithRedefinitionMatched() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -558,7 +558,7 @@ public void testSkipRedefinitionWithNonRedefinable() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -590,7 +590,7 @@ public void testSkipRedefinitionWithNonMatched() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -624,7 +624,7 @@ public void testSkipRedefinitionWithIgnoredType() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -662,7 +662,7 @@ public void testSkipRedefinitionWithIgnoredClassLoader() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -699,7 +699,7 @@ public void testSkipRedefinitionWithIgnoredTypeChainedConjunction() throws Excep
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -734,7 +734,7 @@ public void testSkipRedefinitionWithIgnoredTypeChainedDijunction() throws Except
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -769,7 +769,7 @@ public void testSkipRedefinitionWithNonMatchedListenerException() throws Excepti
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -803,7 +803,7 @@ public void testSkipRedefinitionWithNonMatchedListenerFinishedException() throws
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -836,7 +836,7 @@ public void testSuccessfulWithRedefinitionMatchedChunked() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION_CHUNKED) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION_CHUNKED)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -871,7 +871,7 @@ public void testRedefinitionChunkedOneFails() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION_CHUNKED) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION_CHUNKED)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -900,7 +900,7 @@ public void testRedefinitionNotSupported() throws Exception {
new AgentBuilder.Default(byteBuddy) new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -918,7 +918,7 @@ public void testTransformationWithError() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -944,7 +944,7 @@ public void testIgnored() throws Exception {
.thenReturn(false); .thenReturn(false);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -981,7 +981,7 @@ public void testAuxiliaryTypeInitialization() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -1019,7 +1019,7 @@ public void testRedefinitionConsiderationException() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -1045,7 +1045,7 @@ public void testRetransformationConsiderationException() throws Exception {
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -1072,7 +1072,7 @@ public void testRedefinitionConsiderationExceptionListenerException() throws Exc
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.REDEFINITION) .with(AgentBuilder.RedefinitionStrategy.REDEFINITION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -1099,7 +1099,7 @@ public void testRetransformationConsiderationExceptionListenerException() throws
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand All @@ -1122,7 +1122,7 @@ public void testDecoratedTransformation() throws Exception {
.thenReturn(true); .thenReturn(true);
ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy) ClassFileTransformer classFileTransformer = new AgentBuilder.Default(byteBuddy)
.with(initializationStrategy) .with(initializationStrategy)
.with(typeLocator) .with(poolStrategy)
.with(typeStrategy) .with(typeStrategy)
.with(installationStrategy) .with(installationStrategy)
.with(listener) .with(listener)
Expand Down Expand Up @@ -1193,7 +1193,7 @@ public void testDisabledBootstrapInjection() throws Exception {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testExecutingTransformerHandlesNullValue() throws Exception { public void testExecutingTransformerHandlesNullValue() throws Exception {
assertThat(new AgentBuilder.Default.ExecutingTransformer(byteBuddy, assertThat(new AgentBuilder.Default.ExecutingTransformer(byteBuddy,
typeLocator, poolStrategy,
typeStrategy, typeStrategy,
locationStrategy, locationStrategy,
listener, listener,
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class AgentBuilderDescriptionStrategyTest {
private TypePool typePool; private TypePool typePool;


@Mock @Mock
private AgentBuilder.TypeLocator typeLocator; private AgentBuilder.PoolStrategy poolStrategy;


@Mock @Mock
private TypeDescription typeDescription; private TypeDescription typeDescription;
Expand Down Expand Up @@ -58,16 +58,16 @@ public void testDescriptionPoolOnly() throws Exception {


@Test @Test
public void testLoadedDescriptionHybrid() throws Exception { public void testLoadedDescriptionHybrid() throws Exception {
assertThat(AgentBuilder.DescriptionStrategy.Default.HYBRID.apply(Object.class, typeLocator, locationStrategy), is(TypeDescription.OBJECT)); assertThat(AgentBuilder.DescriptionStrategy.Default.HYBRID.apply(Object.class, poolStrategy, locationStrategy), is(TypeDescription.OBJECT));
assertThat(AgentBuilder.DescriptionStrategy.Default.HYBRID.apply(Object.class, typeLocator, locationStrategy), instanceOf(TypeDescription.ForLoadedType.class)); assertThat(AgentBuilder.DescriptionStrategy.Default.HYBRID.apply(Object.class, poolStrategy, locationStrategy), instanceOf(TypeDescription.ForLoadedType.class));
} }


@Test @Test
public void testLoadedDescriptionPoolOnly() throws Exception { public void testLoadedDescriptionPoolOnly() throws Exception {
when(typeLocator.typePool(ClassFileLocator.ForClassLoader.of(Object.class.getClassLoader()), Object.class.getClassLoader())).thenReturn(typePool); when(poolStrategy.typePool(ClassFileLocator.ForClassLoader.of(Object.class.getClassLoader()), Object.class.getClassLoader())).thenReturn(typePool);
when(typePool.describe(Object.class.getName())).thenReturn(new TypePool.Resolution.Simple(typeDescription)); when(typePool.describe(Object.class.getName())).thenReturn(new TypePool.Resolution.Simple(typeDescription));
when(locationStrategy.classFileLocator(Object.class.getClassLoader(), JavaModule.ofType(Object.class))).thenReturn(ClassFileLocator.ForClassLoader.of(Object.class.getClassLoader())); when(locationStrategy.classFileLocator(Object.class.getClassLoader(), JavaModule.ofType(Object.class))).thenReturn(ClassFileLocator.ForClassLoader.of(Object.class.getClassLoader()));
assertThat(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY.apply(Object.class, typeLocator, locationStrategy), is(typeDescription)); assertThat(AgentBuilder.DescriptionStrategy.Default.POOL_ONLY.apply(Object.class, poolStrategy, locationStrategy), is(typeDescription));
} }


@Test @Test
Expand Down

0 comments on commit a33f3b9

Please sign in to comment.