### Question:
StatusesServiceImpl implements StatusesService { @Override public List<Status> getStatus(Repository repository, String sha1) { if (repository == null) { throw new NullPointerException("Repository can't be null"); } if (sha1 == null) { throw new NullPointerException("SHA1 can't be null"); } log.info("Checking status for {} @ {}", repository.getDirectory(), sha1); if (!containsCommit(repository, sha1)) { log.warn(String.format("Commit %s unknown in repository %s", sha1, repository.getDirectory())); return Arrays.asList(Status.UNKNOWN); } List<Status> statuses = new ArrayList<Status>(); for (BuildResult result: dao.getAll(repository, sha1)) { statuses.add(result.getExitCode() == 0 ? Status.OK : Status.ERROR); } switch (getState(sha1)) { case RUNNING: statuses.add(Status.RUNNING); break; case PENDING: statuses.add(Status.PENDING); break; case NONE: if (statuses.isEmpty()) { statuses.add(Status.NEW); } break; } return statuses; } @Inject  StatusesServiceImpl(GitUtils gitUtils, BuildDAO dao, Pipeline pipeline); @Override List<Status> getStatus(Repository repository, String sha1);  }### Answer:
@Test public void testGetStatus_withBuilds() { assertThat(service.getStatus(test, C1)).containsExactly(Status.OK); assertThat(service.getStatus(test, C2)).containsExactly(Status.OK, Status.ERROR); }
@Test public void testGetStatus_withBuilds_running() { givenRunning(C2); assertThat(service.getStatus(test, C2)).containsExactly(Status.OK, Status.ERROR, Status.RUNNING); }
@Test public void testGetStatus_withBuilds_pending() { givenPending(C2); assertThat(service.getStatus(test, C2)).containsExactly(Status.OK, Status.ERROR, Status.PENDING); }
@Test public void testGetStatus_unknown() { assertThat(service.getStatus(test, "1111111111111111111111111111111111111111")).containsExactly(Status.UNKNOWN); }
@Test public void testGetStatus_new_running() { givenRunning(C3); givenContainsCommit(test, C3); assertThat(service.getStatus(test, C3)).containsExactly(Status.RUNNING); }
@Test public void testGetStatus_new_pending() { givenPending(C2); givenContainsCommit(test, C3); assertThat(service.getStatus(test, C3)).containsExactly(Status.PENDING); assertThat(service.getStatus(test, C2)).containsExactly(Status.OK, Status.ERROR, Status.PENDING); }
@Test public void testGetStatus_withoutBuild() { assertThat(service.getStatus(test, "ac61d48e3020f61c4d7a19709494f37065c87d34")).containsExactly(Status.NEW); }