Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Testing
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Testing
how to mock the abstract interface
shiva nath
Greenhorn
Posts: 8
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Mocking abstract interface does not work , i tried like this, getting null pointer in the text
string
TextMessage mockTextMessage = mock(TextMessage.class); when(mockTextMessage.getText()).thenReturn(FacadeLayerDataMock.getStr()); Actual method public void onMessage(Message message) { String text = ((TextMessage)message).getText(); }
Test
method
@Test public void onMessageTest() { try { nicsCheckMDB.onMessage(FacadeLayerDataMock.getMessage()); } catch (Exception e) { Assert.fail("Exception occured : " + e); } }
Tim Cooke
Sheriff
Posts: 5555
326
I like...
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Do you not want to pass in your
mockTextMessage
into
nicsCheckMDB.onMessage()
?
Tim Driven Development
| Test until the fear goes away
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JMS Consumer ends even after implementing MessageListener interface.
JMS Consumer not receiving any messages.
EasyMock 3.0 Question
Writing to a JMS Queue via Timer Method.
Using JMS on a client only, outside of a container
More...