Skip to content

Commit

Permalink
Mosip 17586 sonar coverage 23 (#810)
Browse files Browse the repository at this point in the history
* WIP-idservimpl-tests

* Added test case

* Test fix

* Added tests

* Minor refactoring

* Added tests

* Fix failed test

* Fixed test

* Added tests

* Minor refactoring for performance
  • Loading branch information
loganathan-sekaran authored Jan 20, 2022
1 parent e22882a commit 2396f76
Show file tree
Hide file tree
Showing 2 changed files with 482 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ private void validatePartnerMappingDetails(Optional<PartnerMapping> partnerMappi
IdAuthenticationErrorConstants.PARTNER_POLICY_NOT_ACTIVE.getErrorCode(),
IdAuthenticationErrorConstants.PARTNER_POLICY_NOT_ACTIVE.getErrorMessage());
}
if (!(partnerMapping.getPolicyData().getPolicyCommenceOn().isBefore(DateUtils.getUTCCurrentDateTime())
&& partnerMapping.getPolicyData().getPolicyExpiresOn().isAfter(DateUtils.getUTCCurrentDateTime()))) {
if (partnerMapping.getPolicyData().getPolicyCommenceOn().isAfter(DateUtils.getUTCCurrentDateTime())
|| partnerMapping.getPolicyData().getPolicyExpiresOn()
.isBefore(DateUtils.getUTCCurrentDateTime())) {
throw new IdAuthenticationBusinessException(
IdAuthenticationErrorConstants.PARTNER_POLICY_NOT_ACTIVE.getErrorCode(),
IdAuthenticationErrorConstants.PARTNER_POLICY_NOT_ACTIVE.getErrorMessage());
Expand All @@ -162,8 +163,9 @@ private void validatePartnerMappingDetails(Optional<PartnerMapping> partnerMappi
throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.PARTNER_DEACTIVATED.getErrorCode(),
IdAuthenticationErrorConstants.PARTNER_DEACTIVATED.getErrorMessage());
}
if (!(partnerMapping.getApiKeyData().getApiKeyCommenceOn().isBefore(DateUtils.getUTCCurrentDateTime())
&& partnerMapping.getApiKeyData().getApiKeyExpiresOn().isAfter(DateUtils.getUTCCurrentDateTime()))) {
if (partnerMapping.getApiKeyData().getApiKeyCommenceOn().isAfter(DateUtils.getUTCCurrentDateTime())
|| partnerMapping.getApiKeyData().getApiKeyExpiresOn()
.isBefore(DateUtils.getUTCCurrentDateTime())) {
throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.PARTNER_NOT_REGISTERED.getErrorCode(),
IdAuthenticationErrorConstants.PARTNER_NOT_REGISTERED.getErrorMessage());
}
Expand Down
Loading

0 comments on commit 2396f76

Please sign in to comment.