A fairly straightforward question regarding EasyMock. Read up a bunch of resources but not sure what I am missing:
The following snippet is creating a unit test using Test-ng:
@Test(groups = "unit")
public class SchoolTestEasyMock {
@Test
public void test1() {
School mockSchool = EasyMock.createNiceMock(School.class);
EasyMock.replay(mockSchool);
System.out.println(mockSchool.getSchoolNumber());
}
}
Let's assume the School class has a simple getter 'getSchoolNumber' that returns an Integer.
The snippet above is printing a 'null' to the console. Since I'm creating a 'nice' mock shouldn't the 'getSchoolNumber' return a default value of 0? Am I missing something while creating the nice mock?