@Test
public void applyPatch() throws Exception {

  final String partitionPath = "$.group";
  when(roadAdminClient.getRoad(road.getName())).thenReturn(Optional.of(road));
  List<PatchOperation> patchSet = Arrays.asList(PatchOperation.add("/partitionPath", partitionPath));
  underTest.applyPatch(road.getName(), patchSet);
  ArgumentCaptor<PatchSet> patchCaptor = ArgumentCaptor.forClass(PatchSet.class);
  verify(roadAdminClient).updateRoad(patchCaptor.capture());
  PatchSet patch = patchCaptor.getValue();
  assertThat(patch.getDocumentId(), is(road.getName()));
  assertThat(patch.getOperations().size(), is(1));
  assertThat(patch.getOperations().get(0).getOperation(), is(Operation.REPLACE));
  assertThat(patch.getOperations().get(0).getPath(), is("/partitionPath"));
  assertThat(patch.getOperations().get(0).getValue(), is(partitionPath));
}