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

  • SEARCH
  • Home
  • 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 6115441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:05:29+00:00 2026-05-23T15:05:29+00:00

I have a method which is used to check if the given class is

  • 0

I have a method which is used to check if the given class is instance of perticular type.
Say for example myClass is an instance of DBClass I want to return true.
And the DBClass is dynamically defined by customer in the properties file.
So I am reading the properties file, getting the DBClass super type , loading it and checking if given class (i.e myClass) is instance of the DBClass.

And one thing is for sure that the DBCLass which i am trying to check for supertype will not be present in my classpath at running the test case as this dbClass is dynamic and customer specific.

I am not sure how to directly test it or cover it.I am not sure if I need to mock properties file?

I am using Junit and JMock.

Any suggestions on testing the method.
Method is written something like this.

public boolean isDBClass (final Class<?> myClass) {
 //Following line reads the properties file and get the class name for db parent class.
String dbSuperClass = PropertiesReader.PropertyEnum.DB_CLASS_PARENT.toString();
// if myClass is subclass of dbSuperClass return true, false otherwise.
return loadClass(dbSuperClass).isAssignableFrom(myClass); 

}

  • 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-05-23T15:05:30+00:00Added an answer on May 23, 2026 at 3:05 pm

    Well I have find out a work around currently.
    I am providing the a dummy properties file which refers to the dummy class which is in my classpath.

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

Sidebar

Related Questions

I have a gridview for which JQuery drag and drop method is used to
I have a method which i want to convert to Extension Method public static
So I have a method which is supposed to check if a table exists
I have this method which lets me translate the position of an object, animating
I have this method which leaks ~ 6KB : + (EInspectorFacilityInfo*) newWithNode: (CXMLNode*) node
I have a method which returns single word as a String. I need to
I have a method which takes a list and do some processing on it
I have a method which I am trying to call dynamically. That method has
i have a method which takes in a DotNetOpenAuth (formally known as DotNetOpenId) Response
I have a method which I would like to invoke asynchronously: void Foo() {

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.