Results 1 to 1 of 1
Thread: Problem in mocking a class
- 10-05-2010, 08:01 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 1
- Rep Power
- 0
Problem in mocking a class
Hi! I am a newbie in on TDD. I'm trying to understand how to perform test on a mock object (I'm using Easymock).
For example, i need to test a validate() method of my class InputFile: this should return true if one or more elements are presents in the List InputFile.documents.
I tried with:
geminiMockFile = control.createMock(InputFile1.class);
EasyMock.expect(geminiMockFile.getDocuments().size ()).andReturn(2);
control.replay();
assertTrue(geminiMockFile.validate());
but this gives a nullpointerexception.
Why this doesn't works? Have I to create also a mock list of documents and fill its?
What's wrong?
Similar Threads
-
Problem to access data when a class calls another class
By ea09530 in forum New To JavaReplies: 0Last Post: 04-04-2010, 10:06 AM -
Mocking a class for Testing
By hotinlavacoolinjava in forum New To JavaReplies: 4Last Post: 09-22-2009, 10:23 AM -
problem in accessing array values of one class in to jframe class
By cenafu in forum AWT / SwingReplies: 8Last Post: 03-21-2009, 09:34 AM -
problem calling function from class to class
By alin_ms in forum New To JavaReplies: 3Last Post: 12-19-2008, 07:35 PM -
Mocking static methods of class
By Kat in forum New To JavaReplies: 3Last Post: 11-08-2007, 12:24 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks