@Test
public void test_updateOnboardedServiceAccount_failure_ttl_greaterthan_max() throws Exception {

    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"errors\":[\"Password Expiration Time must be less than Maximum expiration time (MAX_TTL) for this Service Account\"]}");
    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    UserDetails userDetails = getMockUser(true);
    ServiceAccount serviceAccount = new ServiceAccount();
    serviceAccount.setName("testacc02");
    serviceAccount.setAutoRotate(true);
    serviceAccount.setTtl(90L);
    serviceAccount.setMax_ttl(89L);
    serviceAccount.setOwner("testacc0`");
    
rviceAccountTTL serviceAccountTTL = new ServiceAccountTTL();
rviceAccountTTL.setRole_name(serviceAccount.getName());
rviceAccountTTL.setService_account_name(serviceAccount.getName() + "@null") ;
rviceAccountTTL.setTtl(serviceAccount.getTtl());
    Response response = getMockResponse(HttpStatus.OK, true, "{\"keys\":[\"testacc02\"]}");
    when(reqProcessor.process(Mockito.anyString(),Mockito.anyObject(),Mockito.anyString())).thenReturn(response);
    when(JSONUtil.getJSON((ServiceAccountTTL)Mockito.any())).thenReturn(getJSON(serviceAccountTTL));
    List<ADServiceAccount> allServiceAccounts = new ArrayList<>();
    allServiceAccounts.add(generateADServiceAccount("testacc02"));
    ReflectionTestUtils.setField(serviceAccountsService, "ldapTemplate", ldapTemplate);
    when(ldapTemplate.search(Mockito.anyString(), Mockito.any(), Mockito.any(AttributesMapper.class))).thenReturn(allServiceAccounts);
    ResponseEntity<String> responseEntityActual =  serviceAccountsService.updateOnboardedServiceAccount(token, serviceAccount, userDetails);
    assertEquals(HttpStatus.BAD_REQUEST, responseEntityActual.getStatusCode());
    assertEquals(responseEntityExpected, responseEntityActual);
}