package ru.tinkoff.batchprocessing.claim.fnol
uses gw.api.system.server.Runlevel
uses gw.testharness.RunLevel
uses gw.testharness.ServerTest
uses gw.testharness.TestBase
uses ru.tinkoff.claim.fnol.DuplicateClaimFinder
uses ru.tinkoff.util.DatabaseUtil
uses ru.tinkoff.util.builder.ClaimMother
uses ru.tinkoff.util.builder.PolicyMother
@RunLevel(Runlevel.NODAEMONS)
@ServerTest
class DuplicateClaimFinderTest extends TestBase {
private var _duplicateFinder = new DuplicateClaimFinder()
protected override function afterMethod(possibleException : Throwable) {
super.afterMethod(possibleException)
DatabaseUtil.cleanAllTables()
}
public function test_CommitedClaimTooOld_then_NoDuplicates() {
var commitedClaim = createAndCommitClaim()
var duplicates = _duplicateFinder.findDuplicates(commitedClaim.LossDate.addDays(8), commitedClaim.Policy)
assertEquals(0, duplicates.Count)
}
private function createAndCommitClaim() : Claim {
return ClaimMother
.complete(UUID.randomUUID().toString())
.commitWithoutPreUpdate()
}
}