### Question:
TravisRestService { public void updateTreeNodes(List<TreeNode> treeNodes) throws Exception { if (treeNodes.size() == 0) return ; Build build = profContextDumpRepository.findOne(treeNodes.get(0).getProfId()) .getBuild(); logger.info("update about build id: {}", build.getId()); jandyWorker.put(build.getTravisBuildId(), JandyTask.UPDATE, treeNodes); }  @Transactional void begin(BuildInfo bi); @Transactional Map<String, ?> createProf(ProfilingInfo profParams); void saveProf(ProfilingContext profilingContext); void updateTreeNodes(List<TreeNode> treeNodes); void finish(long buildId);  }### Answer:
@Test public void testUpdateTreeNodes() throws Exception { ProfilingContext profContext = new Gson().fromJson(IOUtils.toString(ClassLoader.getSystemResource("java-profiler-result/end.json")), ProfilingContext.class); List<TreeNode> treenodes = Arrays.asList(new Gson().fromJson(IOUtils.toString(ClassLoader.getSystemResource("java-profiler-result/treenodes.json")), TreeNode[].class)); Build build = new Build(); build.setId(3L); build.setLanguage(bi.getLang()); build.setTravisBuildId(bi.getBuildId()); build.setNumber(bi.getBuildNum()); build.setBranch(branch); build.setNumSamples(bi.getNumSamples()); ProfContextDump prof = new ProfContextDump(); prof.setId(profContext.getProfId()); prof.setBuild(build); prof.setState(ProfContextState.CREATED); when(profContextDumpRepository.findOne(anyLong())).thenReturn(prof); travisRestService.updateTreeNodes(treenodes); verify(profContextDumpRepository, times(1)).findOne(eq(prof.getId())); verify(jandyWorker, times(1)).put(eq(build.getTravisBuildId()), eq(JandyTask.UPDATE), refEq(treenodes)); }