This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I notice that the reference to the mock is called statusBeen, but you replay feedStatusBean. That looks suspicious to me.
Also, you don't show how you are injecting the statusBean into the code under test. How do you?
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
Actually this is an existing controller for which i need to write UTs for. There is no default constructor in the StatusBean class. I am not sure if we can inject it anyhow.
Joined: Jul 11, 2001
Thanks for the clarification.
I don't understand what having a default constructor (I assume you mean a no-arg constructor) has to do with injectability. You have a statusBean mock. For the code under test to use it, you need to pass it into the code. How are you doing that?
Joined: Jul 30, 2008
I am not sure how to pass the mock to the class under test. I think thats the issue here then.
Can you please let me know how can i pass the mock in the code?