@Test
public void testSetNonExistingViewInfo() 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(null);
  when(zk.create(eq(resourcePath), eq(resourceData), anyListOf(ACL.class), any(CreateMode.class)))
      .thenReturn(null);
  zkManager.setViewInfo(viewInfo);
  verify(zk).create(eq(resourcePath), eq(resourceData),
      anyListOf(ACL.class), any(CreateMode.class));
}