### Question:
UserServiceImpl implements UserService { @Override public User queryUser(QueryUserCondition condition) { outService.remoteCall(); return new User(); } UserServiceImpl();  UserServiceImpl(OutService outService); @Override User queryUser(QueryUserCondition condition);  }### Answer:
@Test public void failQueryUserTest() throws Exception { QueryUserCondition queryUserCondition = new QueryUserCondition(); User user = new UserServiceImpl().queryUser(queryUserCondition); LOGGER.info("queryUserTest：" + user); }
@Test public void successQueryUserTest() throws Exception { QueryUserCondition queryUserCondition = new QueryUserCondition(); OutService outService = new AlwaysSuccessOutServiceImpl(); User user = new UserServiceImpl(outService).queryUser(queryUserCondition); LOGGER.info("queryUserTest：" + user); }