Help me to start

746 views
Skip to first unread message

jaik

unread,
Aug 5, 2009, 6:13:51 AM8/5/09
to mockito
I have configured my mockito in pom.xml and i also set classpath. I
dont know what to do after this. please help me

jaik

unread,
Aug 5, 2009, 7:04:42 AM8/5/09
to mockito
hi

szczepiq

unread,
Aug 5, 2009, 2:58:20 PM8/5/09
to moc...@googlegroups.com
Check out the documentation - there examples:

List mock = Mockito.moc(List.class);

when(mock.get(0)).thenReturn("foo");

System.out.println(mock.get(0));

taa daam! your first mock is up!

Cheers,
Szczepan Faber

jaik

unread,
Aug 6, 2009, 6:49:29 AM8/6/09
to mockito
Thanks for your reply.
Can you please give me one simple program and how to do mockito on
that program.
==================================
See this is my java program

import java.io.*;
public class examplemock
{
public static void main(String args[])
{
System.out.println("Hello world!");
}
}
and i tried to test this program using mockitoand this is my testing
program

import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class testmock
{
public static void main(String args[])
{
usage();
}
public static void usage()
{
List mockedList = mock(List.class);
mockedList.add("one");
mockedList.clear();
verify(mockedList).add("one");
verify(mockedList).clear();
}
}

I know my procedure is wrong but i couldnt get any other idea.help me


On Aug 5, 11:58 pm, szczepiq <szcze...@gmail.com> wrote:
> Check out the documentation - there examples:
>
> List mock = Mockito.moc(List.class);
>
> when(mock.get(0)).thenReturn("foo");
>
> System.out.println(mock.get(0));
>
> taa daam! your first mock is up!
>
> Cheers,
> Szczepan Faber
>

szczepiq

unread,
Aug 6, 2009, 10:06:49 AM8/6/09
to moc...@googlegroups.com
Take a look at Brett's tutorial:
http://schuchert.wikispaces.com/Mockito.LoginServiceExample

Szczepan

jaik

unread,
Aug 7, 2009, 4:23:49 AM8/7/09
to mockito
Thank you.The site you have given is very useful

On Aug 6, 7:06 pm, szczepiq <szcze...@gmail.com> wrote:
> Take a look at Brett's tutorial:http://schuchert.wikispaces.com/Mockito.LoginServiceExample
>
> Szczepan
>
Reply all
Reply to author
Forward
0 new messages