package io.github.classgraph.features;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;

public class DeclaredVsNonDeclared {

    public abstract static class A {
        float x;

        abstract void y(int x, int y);

        abstract void y(String x);

        abstract void y(Integer x);
    }

    public abstract static class B extends A {
        int x;

        @Override
        void y(final int x, final int y) {
        }
    }

    @Test
    public void declaredVsNonDeclared() {
        try (ScanResult scanResult = new ClassGraph().enableAllInfo()
                .whitelistPackages(DeclaredVsNonDeclared.class.getPackage().getName()).scan()) {
            final ClassInfo A = scanResult.getClassInfo(A.class.getName());
            final ClassInfo B = scanResult.getClassInfo(B.class.getName());

            assertThat(A.getFieldInfo().get(0).getTypeDescriptor().toString()).isEqualTo("float");
            assertThat(B.getFieldInfo().get(0).getTypeDescriptor().toString()).isEqualTo("int");
            assertThat(B.getMethodInfo().toString()).isEqualTo(
                    "[void y(int, int), abstract void y(java.lang.String), abstract void y(java.lang.Integer)]");
            assertThat(B.getDeclaredMethodInfo().toString()).isEqualTo("[void y(int, int)]");
        }
    }
}

@@ -960,17 +960,16 @@
 ame());%0A
-%0A
         
@@ -1330,24 +1330,24 @@
 nteger)%5D%22);%0A
-
             
@@ -1443,11 +1443,591 @@
  %7D%0A    %7D
+%0A%0A    @Test%0A    public void loadFieldAndMethod() %7B%0A        try (ScanResult scanResult = new ClassGraph().enableAllInfo()%0A                .whitelistPackages(DeclaredVsNonDeclared.class.getPackage().getName()).scan()) %7B%0A            final ClassInfo A = scanResult.getClassInfo(A.class.getName());%0A            final ClassInfo B = scanResult.getClassInfo(B.class.getName());%0A            assertThat(B.getFieldInfo(%22x%22).loadClassAndGetField().getName()).isEqualTo(%22x%22);%0A            assertThat(B.getMethodInfo(%22y%22).get(0).loadClassAndGetMethod().getName()).isEqualTo(%22y%22);%0A        %7D%0A    %7D
 %0A%7D%0A

Add tests for loading methods and fields