@Test public void testVisitFieldInsn() { AsmClass tagNameClass = asmClassProvider.getClass("tags/TagName"); AsmField nameField = tagNameClass.getField("name"); AsmMethod constructorWithString = tagNameClass.getMethod("<init>(Ljava/lang/String;)V"); assertThat(constructorWithString.getCallsToField()).containsOnly(nameField); }
@Test public void testVisitMethodInsn() { AsmClass sourceFileClass = asmClassProvider.getClass("tags/SourceFile"); AsmMethod readMethod = sourceFileClass.getMethod("read()V"); AsmMethod readSourceFileMethod = sourceFileClass.getMethod("readSourceFile()V"); assertThat(readSourceFileMethod.getCallsToMethod()).contains(readMethod).hasSize(2); assertThat(readSourceFileMethod.getCallsToField()).hasSize(1); }