public void isLatestTime(Account account, Region region, ResourceType resourceType, DateTime dt) {
   Validate.noNullElements(new Object[] {account, region, resourceType, dt});
   Optional<Ec2Version> oEc2Version =
       awsService.findLatestEc2Version(account.getId(), resourceType, region);
   if (oEc2Version.isPresent()) {
     Ec2Version ec2Version = oEc2Version.get();
     if (ec2Version.getTimeDetected().after(dt.toDate())) {
       throw new IllegalArgumentException(
           String.format(
               "latest ec2version is:%s which is later than datetime:%s",
               ec2Version.getTimeDetected(), dt.toDate()));
     }
   }
 }
 public void validate(Ec2Version oldVersion, Ec2Version newVersion) {
   Validate.noNullElements(new Object[] {oldVersion, newVersion});
   Validate.isTrue(oldVersion.getAccountId().equals(newVersion.getAccountId()));
   Validate.isTrue(oldVersion.getRegion().equals(newVersion.getRegion()));
   Validate.isTrue(oldVersion.getResourceType().equals(newVersion.getResourceType()));
 }