How to create parameterized constructor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anuja T`
    New Member
    • Mar 2012
    • 2

    How to create parameterized constructor

    Hi All,

    i have a test class.It allows exactly one zero-argument constructor.
    i have another performancetest class,in which i have to pass the respective method name for its performance testing.
    but for paasing that method name,i have to first intialize it through parameterized constructor.
    My test class doesnt allow me to create parameterized constructor.
    so,is there any alternative to constructor??
    plz reply if anyone has solution..
    Thank you...
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    What do you mean by

    but for passing that method name,i have to first intialize it through parameterized constructor.
    ?
    Why do you have to do this? If your class doesn't have a parameterized constructor then you shouldn't have a requirement to create an instance of it through a parameterized constructor.
    You can create a new instance using the default constructor through
    class.newInstan ce() but I don't see why passing a method name requires a parameterized constructor call.

    Comment

    • Anuja T`
      New Member
      • Mar 2012
      • 2

      #3
      java

      oh..
      first of all,thanks for replying too quick.
      let me explain.
      attached file is the code for performance testing.
      in that i hv passed tht "countProje cts" method name against which i hv to do perf testing.project serviceTest is the provided test class.
      this is just sample.i hv more methods like that.
      whnvr i try to pass tht name as parameter,its gvs me error like "create parameterized constructor to initialize."
      but my test class which is provided to me doesnt allow me to do tht.
      my work is just to do performance testing.
      can i create a method which can work on behalf of the constructor.
      or any other alternative???? ???
      Attached Files

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        How do you tell the ProjectServiceT est which class the method is on?
        Looks like you need to see the API specs for you ProjectServiceT est to see what it requires for you to use it successfully.

        Comment

        • Anuja T
          New Member
          • Jan 2012
          • 12

          #5
          i didnt get your question???? can u please elaborate....

          Comment

          Working...