### Question:
SendBuildCommand extends AbstractCommand<SendBuildCommand> { @Override public void run() { try { String userId = env.getEnv().get(Environment.ENV_USER); this.committer = userService.find(userId); if (readStdin) { String line = null; while((line = stdin.readLine()) != null) { if ("--".equals(line)) { break; } handle(line); } } else { handle(this.sha1); } callback.onExit(0); } catch (AccessControlException e) { log.error(e.getMessage()); callback.onExit(2, e.getMessage()); } catch (Exception e) { log.error(e.getMessage()); callback.onExit(1, e.getMessage()); } } SendBuildCommand(Context ctx, QueueService buildQueueService, UserIdentityService userService); @Override void destroy(); @Override void setInputStream(InputStream in); @Override void run(); @Override SendBuildCommand command(String command);  }### Answer:
@Test public void run() throws Exception { UserIdentity expectedUserIdentity = new UserIdentity("ptitfred@localhost", "ptitfred"); given(userService.find("ptitfred")).willReturn(expectedUserIdentity); command.setForce(false); command.setSha1("HEAD"); command.setCommand("HEAD^"); command.setRepo(repo); ObjectId what = ObjectId.zeroId(); given(repo.resolve("HEAD")).willReturn(what); ObjectId whatElse = ObjectId.fromString("0123456789012345678901234567890123456789"); given(repo.resolve("HEAD^")).willReturn(whatElse); command.run(); verify(userService).find("ptitfred"); verify(buildQueueService).enqueueBuild(expectedUserIdentity, repo, "0000000000000000000000000000000000000000", "0123456789012345678901234567890123456789", false); }