@Test
public void test_onboardServiceAccount_succss_autorotate_on_ttl_biggerthan_maxallowed() {

    UserDetails userDetails = getMockUser(true);
    String token = userDetails.getClientToken();
    ServiceAccount serviceAccount = generateServiceAccount("testacc02","testacc01");
    serviceAccount.setAutoRotate(true);
    serviceAccount.setTtl(1590897977L);
    serviceAccount.setMax_ttl(1590897977L);
    String expectedResponse = "{\"errors\":[\"Invalid value provided for Password Expiration Time. This can't be more than 31536000 for this Service Account\"]}";
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(expectedResponse);
    Response response = getMockResponse(HttpStatus.OK, true, "{\"keys\":[\"testacc03\"]}");
    when(reqProcessor.process("/ad/serviceaccount/onboardedlist","{}",token)).thenReturn(response);
    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> responseEntity = serviceAccountsService.onboardServiceAccount(token, serviceAccount, userDetails);
    assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}