Open OzGhost opened 7 months ago
Selected option:
Mockito
syntaxv0.0.1:
Sample:
java -jar mockgen.jar /tmp/project/src/main/services/AddressService.java
Output on stdout:
when(addrDao.create(arg0, arg1, arg2, arg3)).thenReturn(out0);
when(addrDao.create(any(), any(), any(), any())).thenReturn(out0);
when(addrDao.delete(arg0)).thenThrow(ex0);
when(addrDao.delete(any())).thenThrow(ex0);
doNothing().when(addrDao).update(arg0);
doNothing().when(addrDao).update(any());
doThrow(ex0).when(addrDao).merge(arg0, arg1);
doThrow(ex0).when(addrDao).merge(any(), any());
public class AddressService {
@Inject
private AddressDao addrDao;
public Address create(Address address) {
return addrDao.create(address);
}
public int delete(Address address) {
return addrDao.delete(address);
}
public void update(Address address) {
addrDao.update(address);
}
public Address merge(Address addr1, Address addr2) {
return addrDao.merge(addr1, addr2);
}
}
Situation
Expectation
Mockito
(for popularity) orjMockit
(for execution speed).