• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Simple test tool for functions

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all I would like to say Hello to everyone as I am a newjoiner.


I am beginning my java trip right now.
Hence first question...

I am using Eclipse environment.
Let's assume I need to develop only one function, that will be implemented to some system.
For this I do not need a class, just a function with input parameters and return parameter.

The thing is that among the others I would like to pass arrays as parameters and return an array.

So let's say my function would be:


Now. ... I would like to test my function.
I could create a class then in code fill arrays aString1, aString2 and aString3 with data then pass them to my function.
But this is time consuming (not that I am a lazy guy :P )

I just just need to have possobility to increase/decrease number of params for my function along with number and content of items in arrays.
For every change I would need to re-code my class.

And finally ... my question

Is it possible to facilitate my testing with some Eclipse tool?
That I am able to test only my function(I should say method)
For example fill arrays through Grid components copy-pasting the contents right before launching the function?

I would really appreciate your tips.


Regards,
P.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Let's assume I need to develop only one function, that will be implemented to some system.
For this I do not need a class, just a function with input parameters and return parameter.



All methods/functions have to sit inside something- hence a class file. If you don't need to instantiate an object then make the method static.

I could create a class then in code fill arrays aString1, aString2 and aString3 with data then pass them to my function.


Sounds like your making too much work for yourself though. Why not have 1 function that accepts a list of arrays?


Now, you can have as many arrays as you want passed in to a single method.

Is it possible to facilitate my testing with some Eclipse tool?


Try JUnit for unit testing.
reply
    Bookmark Topic Watch Topic
  • New Topic