Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8471845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:54:28+00:00 2026-06-10T16:54:28+00:00

I’m currently testing api’s that are given to us in a jar. I am

  • 0

I’m currently testing api’s that are given to us in a jar.
I am attempting to get a ‘coverage’ or list of the jar-methods and objects that we have touched or that at least our source code references.

What we have or will have available is a text format of “here is a list of API’s”

And we need to cross reference our own application to ensure we are covering the API’s listed.

…

Here’s a simplified example… Below I listed an example of the external code available from the jar, and the code we have using those APIs.

— EXTERNAL_USE_CLASS — MOCKS the external JAR with public API’s that we need to cover

package external_api;

public class EXTERNAL_USE_CLASS {
    String myString;
    Integer myInteger;
    Boolean has_ran;
    public EXTERNAL_USE_CLASS() {
        myString = "initial_string";
        myInteger = 4;
        has_ran = false;
    }
    public String getMyString() {
        return myString;
    }
    public void setMyString(String myString) {
        this.myString = myString;
    }
    public Integer getMyInteger() {
        return myInteger;
    }
    public void setMyInteger(Integer myInteger) {
        this.myInteger = myInteger;
    }
    public Boolean getHas_ran() {
        return has_ran;
    }
    public void setHas_ran(Boolean has_ran) {
        this.has_ran = has_ran;
    }
}

My project will import the above as a jar and add it to the build path.
What my code will do, is something like this:

UseExtJar — mocks our test application using the external jars objects/mathods

import external_api.EXTERNAL_USE_CLASS;

public class UseExtJar {
    static EXTERNAL_USE_CLASS u = new EXTERNAL_USE_CLASS();

    //below is callable via a CLI interface test APP.
    public static void test_basics() {
        Boolean hasRan = u.getHas_ran();
        Integer getInt = u.getMyInteger();
        String getString = u.getMyString();
        System.out.println("u.getHas_ran()"+hasRan);
        System.out.println("u.getMyInteger()"+getInt);
        System.out.println("u.getMyString()"+getString);
    }
}

And what I am interested in exposing are all the API’s touched from the external Jar.

(which namely would these lines)

    Boolean hasRan = u.getHas_ran();
    Integer getInt = u.getMyInteger();
    String getString = u.getMyString();

And If possible… I’d like to be able to print out some report to the effect of saying

Your Object Method ‘test_basics’ has used the following api’s:
–external_api.EXTERNAL_USE_CLASS.getHas_ran()
–external_api.EXTERNAL_USE_CLASS.getMyInteger()
–external_api.EXTERNAL_USE_CLASS.getMyString()

The above names I had to get by going to my test-class and right clicking in eclipse and saying ‘copy qualified name’.

Which is kind of a pain if we have to do this for 1,000’s of APIs…. I just figured theres some way to logically print out a trace.

It could be I just dont know the proper google search terms, and this is a common easy task.

Much Appreciated for any help/pointers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:54:29+00:00Added an answer on June 10, 2026 at 4:54 pm

    Thanks.

    I started with reflection as you suggested, and then drifted towards ASM because I’m working with bytecode.


    I pulled my reference from 2 links referencing ASM and reflection

    Java: Easy way to get method stub out of class files within a JAR file? Reflection?

    How can I find all the methods that call a given method in Java?


    My solution essentially solves the problem in 2 steps

    1. read all the target-methods from the external-jar

    via ASM, read in all class/method objects that are public that satisfy a class path (com.my.class.object.*) and some opt-code filters (not private, not abstract, etc) and append all that satisfy the filtering to a list of objects storing the class/method.

    2. foreach target-method, check if its existent in our source code.

    For each target class/method found, just as the link provided above does, I can check where, and print all the occurances with line/filenames etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.