mirror of
https://github.com/valitydev/claim-management.git
synced 2024-11-06 10:15:22 +00:00
BJ-782: Throw exception when revision is invalid (#13)
This commit is contained in:
parent
33250f72b8
commit
137954ba0f
@ -66,7 +66,7 @@ public class ClaimCommitterService {
|
|||||||
).run();
|
).run();
|
||||||
|
|
||||||
} catch (InvalidClaimStatusException | InvalidRevisionException ex) {
|
} catch (InvalidClaimStatusException | InvalidRevisionException ex) {
|
||||||
log.warn("Claim has been changed, no commit needed", ex);
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.rbkmoney.cm.service;
|
package com.rbkmoney.cm.service;
|
||||||
|
|
||||||
import com.rbkmoney.cm.AbstractWithCommittersIntegrationTest;
|
import com.rbkmoney.cm.AbstractWithCommittersIntegrationTest;
|
||||||
|
import com.rbkmoney.cm.exception.InvalidRevisionException;
|
||||||
import com.rbkmoney.cm.meta.UserIdentityEmailExtensionKit;
|
import com.rbkmoney.cm.meta.UserIdentityEmailExtensionKit;
|
||||||
import com.rbkmoney.cm.meta.UserIdentityIdExtensionKit;
|
import com.rbkmoney.cm.meta.UserIdentityIdExtensionKit;
|
||||||
import com.rbkmoney.cm.meta.UserIdentityRealmExtensionKit;
|
import com.rbkmoney.cm.meta.UserIdentityRealmExtensionKit;
|
||||||
@ -15,7 +16,6 @@ import org.junit.Test;
|
|||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.core.convert.ConversionService;
|
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.scheduling.annotation.AsyncResult;
|
import org.springframework.scheduling.annotation.AsyncResult;
|
||||||
|
|
||||||
@ -38,9 +38,6 @@ public class ClaimCommitterServiceTest extends AbstractWithCommittersIntegration
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ConversionWrapperService conversionWrapperService;
|
private ConversionWrapperService conversionWrapperService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ConversionService conversionService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClaimManagementService claimManagementService;
|
private ClaimManagementService claimManagementService;
|
||||||
|
|
||||||
@ -83,8 +80,12 @@ public class ClaimCommitterServiceTest extends AbstractWithCommittersIntegration
|
|||||||
startSimpleCommitter();
|
startSimpleCommitter();
|
||||||
|
|
||||||
ClaimModel claimModel = createClaimWithPendingAcceptance("party_id");
|
ClaimModel claimModel = createClaimWithPendingAcceptance("party_id");
|
||||||
|
try {
|
||||||
claimCommitterService.doCommitClaim(claimModel.getPartyId(), claimModel.getId(), claimModel.getRevision() + 1);
|
claimCommitterService.doCommitClaim(claimModel.getPartyId(), claimModel.getId(), claimModel.getRevision() + 1);
|
||||||
|
fail();
|
||||||
|
} catch (InvalidRevisionException ex) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
ClaimModel newClaimModel = claimManagementService.getClaim(claimModel.getPartyId(), claimModel.getId());
|
ClaimModel newClaimModel = claimManagementService.getClaim(claimModel.getPartyId(), claimModel.getId());
|
||||||
assertEquals(claimModel.getClaimStatus(), newClaimModel.getClaimStatus());
|
assertEquals(claimModel.getClaimStatus(), newClaimModel.getClaimStatus());
|
||||||
assertEquals(claimModel.getRevision(), newClaimModel.getRevision());
|
assertEquals(claimModel.getRevision(), newClaimModel.getRevision());
|
||||||
|
Loading…
Reference in New Issue
Block a user