### Question:
BuildDAOImpl implements BuildDAO { BuildResult parseNote(Repository repository, String sha1, String data) throws AmbiguousObjectException, IOException { BuildResult r= new BuildResult(sha1); Scanner s=new Scanner(data); s.useDelimiter("\\s{1,}"); String c,d; while (s.hasNext()) { c = s.next(); d = s.next(); if ("log".equals(c)) { try { r.setLog(gitUtils.showBytes(repository, d)); } catch (MissingObjectException e) { r.setLog("Log are missing ...".getBytes()); } } else if ("return-code".equals(c)) { r.setExitCode(Integer.parseInt(d)); } } return r; } @Inject  BuildDAOImpl(GitUtils gitUtils, TimeService timeService); @Override BuildResult getLast(Repository repo, String sha1); @Override List<BuildResult> getAll(Repository repo, String sha1); @Override void save(BuildResult buildResult, Repository repo, String userName, Pair<Long,Integer> when);  }### Answer:
@Test public void testParseNote() throws Exception { String data = "build 47b999bbdad3f33878f51b5a21cb71fda557324c\n" + "log e957a8b6b4997cc3321a7e18dd330ca7cbe8e679\n" + "return-code 38\n" + "author \"ptitfred\" <ptitfred@localhost>\n" + "when 1316391912464 +0200\n"; String log= "row 1\nrow 2\n"; given(gitUtils.showBytes(eq(repo), eq("e957a8b6b4997cc3321a7e18dd330ca7cbe8e679"))).willReturn(log.getBytes()); BuildResult buildResult = dao.parseNote(repo, "47b999bbdad3f33878f51b5a21cb71fda557324c", data); assertThat(buildResult).isNotNull(); assertThat(buildResult.getCommitSha1()).isEqualTo("47b999bbdad3f33878f51b5a21cb71fda557324c"); assertThat(buildResult.getExitCode()).isEqualTo(38); assertThat(buildResult.getLog()).isEqualTo(log.getBytes()); }