@Test
@PrepareForTest(TerrapinUtil.class)
public void testLoadFileSetData() throws Exception {

  TerrapinController.ServiceToClient serviceImpl = mock(TerrapinController.ServiceToClient.class);
  ZooKeeperManager zkManager = mock(ZooKeeperManager.class);
  FileSetInfo fileSetInfo = new FileSetInfo("fileset", "dir", 100,
      new ArrayList<FileSetInfo.ServingInfo>(), new Options());
  InetSocketAddress address = new InetSocketAddress("namenode001", 9090);
  Options requestOptions = new Options();
  when(zkManager.getControllerLeader()).thenReturn(address);
  whenNew(TerrapinController.ServiceToClient.class).withAnyArguments().thenReturn(serviceImpl);
  when(serviceImpl.loadFileSet(any(TerrapinLoadRequest.class))).thenReturn(Future.Void());
  ArgumentCaptor<TerrapinLoadRequest> requestCaptor =
      ArgumentCaptor.forClass(TerrapinLoadRequest.class);
  TerrapinUtil.loadFileSetData(zkManager, fileSetInfo, requestOptions);
  verify(serviceImpl).loadFileSet(requestCaptor.capture());
  TerrapinLoadRequest request = requestCaptor.getValue();
  assertEquals(fileSetInfo.servingInfo.hdfsPath, request.getHdfsDirectory());
  assertEquals(requestOptions, request.getOptions());
  assertEquals(fileSetInfo.fileSetName, request.getFileSet());
  assertEquals(fileSetInfo.servingInfo.numPartitions, request.getExpectedNumPartitions());
}