private void verifyLocatorProperties(
      String message,
      String accessPolicyId,
      String assetId,
      LocatorType locatorType,
      Date startTime,
      String id,
      String path,
      LocatorInfo actualLocator) {
    assertNotNull(message, actualLocator);
    assertEquals(message + " accessPolicyId", accessPolicyId, actualLocator.getAccessPolicyId());
    assertEquals(message + " assetId", assetId, actualLocator.getAssetId());
    assertEquals(message + " locatorType", locatorType, actualLocator.getLocatorType());

    assertDateApproxEquals(message + " startTime", startTime, actualLocator.getStartTime());

    if (id == null) {
      assertNotNull(message + " Id", actualLocator.getId());
    } else {
      assertEquals(message + " Id", id, actualLocator.getId());
    }
    if (path == null) {
      assertNotNull(message + " path", actualLocator.getPath());
    } else {
      assertEquals(message + " path", path, actualLocator.getPath());
    }
  }
  @Test
  public void updateLocatorSuccess() throws ServiceException {
    // Arrange
    LocatorType locatorType = LocatorType.OnDemandOrigin;
    LocatorInfo locatorInfo =
        service.create(
            Locator.create(accessPolicyInfoRead.getId(), assetInfo.getId(), locatorType));

    Date startTime = new Date();
    startTime.setTime(startTime.getTime() - tenMinutesInMS);

    // Act
    service.update(Locator.update(locatorInfo.getId()).setStartDateTime(startTime));
    LocatorInfo updatedLocatorInfo = service.get(Locator.get(locatorInfo.getId()));

    // Assert
    Date expectedExpiration = new Date();
    expectedExpiration.setTime(
        startTime.getTime() + (long) accessPolicyInfoRead.getDurationInMinutes() * minuteInMS);

    verifyLocatorProperties(
        "updatedLocatorInfo",
        locatorInfo.getAccessPolicyId(),
        locatorInfo.getAssetId(),
        locatorInfo.getLocatorType(),
        startTime,
        locatorInfo.getId(),
        locatorInfo.getPath(),
        updatedLocatorInfo);
  }
 private void verifyLocatorInfosEqual(String message, LocatorInfo expected, LocatorInfo actual) {
   verifyLocatorProperties(
       message,
       expected.getAccessPolicyId(),
       expected.getAssetId(),
       expected.getLocatorType(),
       expected.getStartTime(),
       expected.getId(),
       expected.getPath(),
       actual);
 }