Here are two questions from the same test that seem to contradict each other: example 1, example 2.
The two mocks are correct. javax.ejb.EJBContext is the superinterface which declares these methods:
public EJBHome getEJBHome()
public EJBLocalHome getEJBLocalHome()
public java.security.Principal getCallerPrincipal()
public boolean isCallerInRole(java.lang.String roleName)
public UserTransaction getUserTransaction()
public void setRollbackOnly()
public boolean getRollbackOnly()
EJBContext is extended by three interfaces: javax.ejb.MessageDrivenContext (which adds no methods) and by javax.ejb.SessionContext and javax.ejb.EntityContext. The latter two both add these methods:
public EJBLocalObject getEJBLocalObject()
public EJBObject getEJBObject()
Furthermore, EntityContext adds this method:
public java.lang.Object getPrimaryKey()
This is why example 1 and example 2 are correct.