RepositoryService { public String getLastMessage(Project project, String sha) { Repo repo = new Repo(project.getName(), project.getRepository(), project.getRef()); REPOS.computeIfAbsent(repo, key -> checkoutRepository(key)); Path path = REPOS.get(repo); synchronized (path) { checkoutRevision(path, project.getRef(), sha); return commandService.invoke(path, "git", "log", "--pretty=format:%s", "-1"); } }  @PreDestroy void cleanup(); String getLastMessage(Project project, String sha); String getLastSha(Project project); void checkoutRepository(Project project); InputStream getFile(Build build, String filePath);  }
@Test public void shouldGetLastMessage() throws IOException { Project project = getProject(); String lastMessage = service.getLastMessage(project, "cdc902352d18080292daea9b4f99ba5d16801b88"); assertThat(lastMessage).isEqualTo("failure"); }