Skip to content

Commit

Permalink
Refactored native method strategy to be better represented by a type …
Browse files Browse the repository at this point in the history
…if its own.
  • Loading branch information
raphw committed Oct 22, 2015
1 parent a5bf612 commit d40686a
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 54 deletions.
@@ -1,17 +1,15 @@
package net.bytebuddy.agent;

import net.bytebuddy.test.utility.MockitoRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.*;
import org.junit.rules.TestRule;
import org.mockito.Mock;

import java.lang.instrument.Instrumentation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down Expand Up @@ -59,6 +57,15 @@ public void testAgentMain() throws Exception {
assertThat(ByteBuddyAgent.getInstrumentation(), is(instrumentation));
}

@Test
public void testAgentInstallerIsPublic() throws Exception {
Class<?> type = ByteBuddyAgent.Installer.class;
while (type != null) {
Assert.assertThat(Modifier.isPublic(type.getModifiers()), is(true));
type = type.getDeclaringClass();
}
}

@Test(expected = UnsupportedOperationException.class)
public void testConstructorThrowsException() throws Exception {
Constructor<?> constructor = ByteBuddyAgent.Installer.class.getDeclaredConstructor();
Expand Down

0 comments on commit d40686a

Please sign in to comment.