@Test
public void testSetExistingViewInfo() throws Exception {

  ViewInfo viewInfo = mock(ViewInfo.class);
  String resource = "test_resource";
  String resourcePath = VIEWS_DIR + "/" + resource;
  byte[] resourceData = "hello".getBytes();
  when(viewInfo.toCompressedJson()).thenReturn(resourceData);
  when(viewInfo.hasOnlinePartitions()).thenReturn(true);
  when(viewInfo.getResource()).thenReturn(resource);
  when(zk.exists(eq(resourcePath), anyBoolean())).thenReturn(new Stat());
  when(zk.setData(eq(resourcePath), eq(resourceData), eq(-1))).thenReturn(new Stat());
  zkManager.setViewInfo(viewInfo);
  verify(zk).setData(eq(resourcePath), eq(resourceData), eq(-1));
}