@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));
}