@Test
public void testRollbackFileSet() throws Exception {

  ZooKeeperManager mockZKManager = mock(ZooKeeperManager.class);
  FileSetInfo fileSetInfo = new FileSetInfo();
  fileSetInfo.numVersionsToKeep = 4;
  fileSetInfo.oldServingInfoList = ImmutableList.of(
      new FileSetInfo.ServingInfo("/hdfs/path/1", "resource", 1000, PartitionerType.MODULUS),
      new FileSetInfo.ServingInfo("/hdfs/path/2", "resource", 1000, PartitionerType.MODULUS),
      new FileSetInfo.ServingInfo("/hdfs/path/3", "resource", 1000, PartitionerType.MODULUS)
  );
  fileSetInfo.servingInfo =
      new FileSetInfo.ServingInfo("/hdfs/path/4", "resource", 1000, PartitionerType.MODULUS);
  String fileSet = "test_fileset";
  when(mockZKManager.getFileSetInfo(eq(fileSet))).thenReturn(fileSetInfo);
  doNothing().when(mockZKManager).setFileSetInfo(anyString(), any(FileSetInfo.class));
  TerrapinAdmin.rollbackFileSet(mockZKManager, fileSet, fileSetInfo, 1);
  ArgumentCaptor<String> fileSetCaptor = ArgumentCaptor.forClass(String.class);
  ArgumentCaptor<FileSetInfo> fileSetInfoCaptor = ArgumentCaptor.forClass(FileSetInfo.class);
  verify(mockZKManager).setFileSetInfo(fileSetCaptor.capture(), fileSetInfoCaptor.capture());
  assertEquals(fileSet, fileSetCaptor.getValue());
  assertEquals("/hdfs/path/2", fileSetInfoCaptor.getValue().servingInfo.hdfsPath);
  assertEquals(1, fileSetInfoCaptor.getValue().oldServingInfoList.size());
  assertEquals("/hdfs/path/3", fileSetInfoCaptor.getValue().oldServingInfoList.get(0).hdfsPath);
}