Skip to content

Commit

Permalink
Removed ambiguities implied by new Java 9 APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Apr 28, 2016
1 parent a4d8220 commit 352d698
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

public class AgentBuilderDefaultTest {

private static final String FOO = "foo";

private static final byte[] QUX = new byte[]{1, 2, 3}, BAZ = new byte[]{4, 5, 6};

private static final Class<?> REDEFINED = Foo.class, AUXILIARY = Bar.class;
Expand Down Expand Up @@ -945,7 +947,7 @@ public void testDecoratedTransformation() throws Exception {
.installOn(instrumentation);
assertThat(classFileTransformer.transform(REDEFINED.getClassLoader(), REDEFINED.getName(), null, REDEFINED.getProtectionDomain(), QUX), is(BAZ));
verify(listener).onTransformation(new TypeDescription.ForLoadedType(REDEFINED), REDEFINED.getClassLoader(), dynamicType);
verify(listener).onComplete(REDEFINED.getName(), REDEFINED.getClassLoader());;
verify(listener).onComplete(REDEFINED.getName(), REDEFINED.getClassLoader());
verifyNoMoreInteractions(listener);
verify(instrumentation).addTransformer(classFileTransformer, false);
verifyNoMoreInteractions(instrumentation);
Expand Down Expand Up @@ -1016,10 +1018,10 @@ public void testExecutingTransformerHandlesNullValue() throws Exception {
mock(AgentBuilder.Default.BootstrapInjectionStrategy.class),
mock(AgentBuilder.RawMatcher.class),
mock(AgentBuilder.Default.Transformation.class))
.transform(null,
null,
null,
null,
.transform(mock(ClassLoader.class),
FOO,
Object.class,
mock(ProtectionDomain.class),
new byte[0]), nullValue(byte[].class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public void testExplicitLookup() throws Exception {

@Test
public void testExtractingTransformerHandlesNullValue() throws Exception {
assertThat(new ClassFileLocator.AgentBased.ExtractionClassFileTransformer(mock(ClassLoader.class), FOO).transform(null,
null,
null,
null,
assertThat(new ClassFileLocator.AgentBased.ExtractionClassFileTransformer(mock(ClassLoader.class), FOO).transform(mock(ClassLoader.class),
FOO,
Object.class,
mock(ProtectionDomain.class),
new byte[0]), nullValue(byte[].class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.lang.instrument.ClassDefinition;
import java.lang.instrument.Instrumentation;
import java.security.AccessController;
import java.security.ProtectionDomain;
import java.util.Collections;
import java.util.concurrent.Callable;

Expand Down Expand Up @@ -257,10 +258,10 @@ public void testResetEmptyNoEffect() throws Exception {

@Test
public void testTransformerHandlesNullValue() throws Exception {
assertThat(new ClassReloadingStrategy.Strategy.ClassRedefinitionTransformer(Collections.<Class<?>, ClassDefinition>emptyMap()).transform(null,
null,
null,
null,
assertThat(new ClassReloadingStrategy.Strategy.ClassRedefinitionTransformer(Collections.<Class<?>, ClassDefinition>emptyMap()).transform(mock(ClassLoader.class),
FOO,
Object.class,
mock(ProtectionDomain.class),
new byte[0]), nullValue(byte[].class));
}

Expand Down

0 comments on commit 352d698

Please sign in to comment.