wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes unit testing of singleton classes get methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "unit testing of singleton classes get methods" Watch "unit testing of singleton classes get methods" New topic
Author

unit testing of singleton classes get methods

ashok ks
Ranch Hand

Joined: Oct 31, 2003
Posts: 55
How can i unit test the singleton class get methods that return String type ?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
What are your doubts? What did you try and what problems did you encounter?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
What should the get method return? If it's a constant value, the answer is obvious, so I presume the return value varies based on something. I would suggest explaining to us what that something is so we can help you with it.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
ashok ks
Ranch Hand

Joined: Oct 31, 2003
Posts: 55
getmethods return value is String. It's in the Singleton class and it has getInstance().
I have a plan to write separate java pgm to access this get method that return String.
How can i access this getmethod() ?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
At this stage, I'm gonna move the discussion over to JiGB
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unit testing of singleton classes get methods
 
Similar Threads
java(intermediate)
Singleton Question
Singleton and Property File
Concurrent invocation of a singletone method
How is Servlet a singleton?