mirror of
https://gitee.com/arthas/arthas.git
synced 2024-11-29 18:58:37 +08:00
add getInstances interface test
This commit is contained in:
parent
d7a0fdf1e8
commit
f1d86b5c43
@ -151,5 +151,10 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,9 +1,13 @@
|
||||
package arthas;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.taobao.arthas.common.VmToolUtils;
|
||||
|
||||
import arthas.VmToolTest.AAA;
|
||||
import arthas.VmToolTest.III;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -144,4 +148,23 @@ public class VmToolTest {
|
||||
allLoadedClasses = null;
|
||||
}
|
||||
}
|
||||
|
||||
interface III {
|
||||
}
|
||||
|
||||
class AAA implements III {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getInstances_interface() {
|
||||
AAA aaa = new AAA();
|
||||
VmTool vmtool = initVmTool();
|
||||
III[] interfaceInstances = vmtool.getInstances(III.class);
|
||||
Assertions.assertThat(interfaceInstances.length).isEqualTo(1);
|
||||
|
||||
AAA[] ObjectInstances = vmtool.getInstances(AAA.class);
|
||||
Assertions.assertThat(ObjectInstances.length).isEqualTo(1);
|
||||
|
||||
Assertions.assertThat(interfaceInstances[0]).isEqualTo(ObjectInstances[0]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user