### Question:
BuildServiceImpl extends ServiceSupport implements BuildService { public AbstractBuild<?, ?> getBuild(final String projectName, final int buildNumber) { checkProjectName(projectName); checkBuildNumber(buildNumber); AbstractProject<?, ?> project = projects.getProject(projectName); return getBuild(project, buildNumber); } @Inject  BuildServiceImpl(final ProjectService projects, SecurityService security); void deleteBuild(final AbstractProject<?, ?> project, final int buildNumber); void keepBuild(final AbstractProject<?, ?> project, final int buildNumber, final boolean release); AbstractBuild<?, ?> getBuild(final String projectName, final int buildNumber); AbstractBuild<?, ?> getBuild(final AbstractProject<?,?> project, final int buildNumber); AbstractBuild<?, ?> findBuild(final String projectName, final int buildNumber); AbstractBuild<?,?> findBuild(final AbstractProject<?, ?> project, final int buildNumber); void stopBuild(final AbstractProject<?, ?> project, final int buildNumber);  }### Answer:
@Test(expected = NullPointerException.class) public void getBuildProjectNullProject() { getInst().getBuild((AbstractProject<?, ?>) null, 1); }
@Test(expected = IllegalArgumentException.class) public void getBuildProjectBuildNumber() { getInst().getBuild(project, -1); }
@Test(expected = IllegalArgumentException.class) public void getBuildProjectZeroBuildNumber() { getInst().getBuild(project, 0); }
@Test public void getBuildByProjectSecurity() throws IOException { BuildService buildService = spy(getInst()); doReturn(build).when(project).getBuildByNumber(1); buildService.getBuild(project, 1); verify(securityService).checkPermission(build, Item.READ); }
@Test(expected = BuildNotFoundException.class) public void getBuildByProjectBuildNotFoundException() throws IOException { getInst().getBuild(project, 1); }
@Test(expected = NullPointerException.class) public void getBuildProjectNameNullName() { getInst().getBuild((String) null, 1); }
@Test(expected = IllegalArgumentException.class) public void getBuildProjectNameNegativeBuildNumber() { getInst().getBuild("projectName", -1); }
@Test(expected = IllegalArgumentException.class) public void getBuildProjectNameZeroBuildNumber() { getInst().getBuild("projectName", 0); }
@Test public void getBuildByProjectNameSecurity() throws IOException { BuildService buildService = spy(getInst()); doReturn(build).when(project).getBuildByNumber(1); doReturn(project).when(projectService).getProject("projectName"); buildService.getBuild("projectName", 1); verify(securityService).checkPermission(build, Item.READ); }
@Test(expected = BuildNotFoundException.class) public void getBuildByProjectNameBuildNotFoundException() throws IOException { doReturn(project).when(projectService).getProject("projectName"); getInst().getBuild("projectName", 1); }