Fixing Sdf01ExecutorTest.
This commit is contained in:
parent
5685f95ce2
commit
b5d92c6cee
3 changed files with 138 additions and 39 deletions
|
|
@ -7,15 +7,23 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
|
import ru.clearing.classes.statics.data.account.AccountBalance;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
|
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||||
|
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||||
|
import ru.clearing.classes.statics.data.statement.Statement;
|
||||||
import ru.spcex.clearing.balance.config.*;
|
import ru.spcex.clearing.balance.config.*;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.platform.enumeration.AccountType;
|
import ru.spcex.platform.enumeration.*;
|
||||||
import ru.spcex.platform.enumeration.Status;
|
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
|
||||||
|
import ru.spcex.platform.utils.number.BigDecimalUtil;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
|
|
@ -29,13 +37,20 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
KafkaSenderConfig.class,
|
KafkaSenderConfig.class,
|
||||||
KafkaTestConfig.class})
|
KafkaTestConfig.class})
|
||||||
public abstract class AbstractServiceTest {
|
public abstract class AbstractServiceTest {
|
||||||
|
protected final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||||
protected final Long accountIdNew = 1L;
|
protected final Long accountIdNew = 1L;
|
||||||
protected final Long addresseeIdNew = 2L;
|
protected final Long addresseeIdNew = 2L;
|
||||||
protected final String deal = "111111111";
|
protected final String deal = "111111111";
|
||||||
protected final String acc = "123456789";
|
protected final String acc = "123456789";
|
||||||
|
protected final BigDecimal amountNew = new BigDecimal(1000);
|
||||||
|
protected final String cashMovementCurrencyCode = CurrencyCode.RUB.getKey();
|
||||||
|
|
||||||
protected AtomicLong currentId = new AtomicLong(0L);
|
protected AtomicLong currentId = new AtomicLong(0L);
|
||||||
protected IMap<Long, Company> companyMap;
|
protected IMap<Long, Company> companyMap;
|
||||||
protected IMap<Long, Account> accountMap;
|
protected IMap<Long, Account> accountMap;
|
||||||
|
protected ImdgHazelcast<Statement> statementImdg;
|
||||||
|
protected ImdgHazelcast<SDf02> sdf02Imdg;
|
||||||
|
protected ImdgHazelcast<AccountBalance> accountBalanceImdg;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("hazelcastServiceTest")
|
@Qualifier("hazelcastServiceTest")
|
||||||
private ImdgProvider hazelcast;
|
private ImdgProvider hazelcast;
|
||||||
|
|
@ -45,6 +60,9 @@ public abstract class AbstractServiceTest {
|
||||||
hazelcast.waitAvailable();
|
hazelcast.waitAvailable();
|
||||||
ImdgHazelcast<Company> companyImdg = (ImdgHazelcast<Company>) hazelcast.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
ImdgHazelcast<Company> companyImdg = (ImdgHazelcast<Company>) hazelcast.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||||
ImdgHazelcast<Account> accountImdg = (ImdgHazelcast<Account>) hazelcast.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
ImdgHazelcast<Account> accountImdg = (ImdgHazelcast<Account>) hazelcast.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
statementImdg = (ImdgHazelcast<Statement>) hazelcast.getImdg(IMDGDistributedNames.Map_Statement, Statement.class);
|
||||||
|
sdf02Imdg = (ImdgHazelcast<SDf02>) hazelcast.getImdg(IMDGDistributedNames.Map_SDf02, SDf02.class);
|
||||||
|
accountBalanceImdg = (ImdgHazelcast<AccountBalance>) hazelcast.getImdg(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class);
|
||||||
companyMap = companyImdg.getMap();
|
companyMap = companyImdg.getMap();
|
||||||
accountMap = accountImdg.getMap();
|
accountMap = accountImdg.getMap();
|
||||||
}
|
}
|
||||||
|
|
@ -66,4 +84,64 @@ public abstract class AbstractServiceTest {
|
||||||
account.setAccountStatus(Status.Active.getKey());
|
account.setAccountStatus(Status.Active.getKey());
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AccountResult getTestAccountResult(Long id, Account account, Company company) {
|
||||||
|
AccountBalance accountBalanceNew = new AccountBalance();
|
||||||
|
accountBalanceNew.setId(id);
|
||||||
|
accountBalanceNew.setCompanyId(addresseeIdNew);
|
||||||
|
accountBalanceNew.setAccountId(account.getId());
|
||||||
|
accountBalanceNew.setAccountType(account.getAccountType());
|
||||||
|
accountBalanceNew.setAccount(account.getAccount());
|
||||||
|
accountBalanceNew.setOpenBalanceAmount(amountNew);
|
||||||
|
accountBalanceNew.setFreeBalanceAmount(amountNew);
|
||||||
|
accountBalanceNew.setBalanceAmount(amountNew);
|
||||||
|
accountBalanceNew.setBalanceAccountType(BalanceAccountType.Active.getKey());
|
||||||
|
accountBalanceNew.setCurrencyCode(cashMovementCurrencyCode);
|
||||||
|
accountBalanceNew.setTradingCode(company.getTradingCode());
|
||||||
|
accountBalanceNew.setShortName(company.getShortName());
|
||||||
|
accountBalanceNew.setFullName(company.getFullName());
|
||||||
|
return new AccountResult(accountBalanceNew);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Statement getTestStatement(Long id, Company company, Account account, SDf01 sdf01) {
|
||||||
|
Statement statement = new Statement();
|
||||||
|
statement.setId(id);
|
||||||
|
statement.setAddresseeId(company.getId());
|
||||||
|
statement.setSenderId(Sender.Prc.getId());
|
||||||
|
statement.setCreated(Instant.now());
|
||||||
|
statement.setClearingDate(LocalDate.now());
|
||||||
|
statement.setStatementType(StatementType.full.getKey());
|
||||||
|
statement.setAccountId(account.getId());
|
||||||
|
statement.setAccount(sdf01.getAccount());
|
||||||
|
statement.setInOutDirection(InOutDirection.in.getKey());
|
||||||
|
statement.setSettlementDate(LocalDate.parse(sdf01.getDat(), datFormatter));
|
||||||
|
statement.setAmount(BigDecimalUtil.parse(sdf01.getRemainder()));
|
||||||
|
statement.setCashMovementCurrencyCode(cashMovementCurrencyCode);
|
||||||
|
statement.setOperationStatus(OperationStatus.Pending.getKey());
|
||||||
|
statement.setInSDfId(sdf01.getId());
|
||||||
|
statement.setInOutSDfType(InOutSDfType.type1.getKey());
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SDf02 getTestSdf02(Long id, SDf01 sdf01, Long generationIdForGroup) {
|
||||||
|
SDf02 sDf02 = new SDf02();
|
||||||
|
sDf02.setId(id);
|
||||||
|
sDf02.setCurr_code(sdf01.getCurr_code());
|
||||||
|
sDf02.setAccount(sdf01.getAccount());
|
||||||
|
sDf02.setRemainder(sdf01.getRemainder());
|
||||||
|
sDf02.setDeal(sdf01.getDeal());
|
||||||
|
sDf02.setAcc_code(sdf01.getAcc_code());
|
||||||
|
sDf02.setDat(sdf01.getDat());
|
||||||
|
sDf02.setMarket(sdf01.getMarket());
|
||||||
|
sDf02.setAcc_name(sdf01.getAcc_name());
|
||||||
|
sDf02.setAcc_type(sdf01.getAcc_type());
|
||||||
|
sDf02.setSumengage(sdf01.getSumengage());
|
||||||
|
sDf02.setSumunblock(sdf01.getSumunblock());
|
||||||
|
sDf02.setFile_type(sdf01.getFile_type());
|
||||||
|
sDf02.setInSDf01Id(sdf01.getId());
|
||||||
|
sDf02.setGenerationId(generationIdForGroup);
|
||||||
|
sDf02.setGenerationTime(Instant.now());
|
||||||
|
sDf02.setResult("OK!");
|
||||||
|
return sDf02;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
|
|
||||||
private static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
private static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
||||||
private final BigDecimal amountNew = new BigDecimal(1000);
|
private final BigDecimal amountNew = new BigDecimal(1000);
|
||||||
private final String cashMovementCurrencyCodeNew = "cash";
|
|
||||||
private final Long accountIdUpdate = accountIdNew;
|
private final Long accountIdUpdate = accountIdNew;
|
||||||
private final Long addresseeIdUpdate = addresseeIdNew;
|
private final Long addresseeIdUpdate = addresseeIdNew;
|
||||||
private final BigDecimal amountUpdate = new BigDecimal(100000);
|
private final BigDecimal amountUpdate = new BigDecimal(100000);
|
||||||
|
|
@ -45,22 +44,8 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
Account account = getTestAccount(accountIdNew);
|
Account account = getTestAccount(accountIdNew);
|
||||||
accountMap.put(accountIdNew, account);
|
accountMap.put(accountIdNew, account);
|
||||||
|
|
||||||
AccountBalance accountBalanceNew = new AccountBalance();
|
AccountResult predictableNewResult = getTestAccountResult(accountIdNew, account, company);
|
||||||
accountBalanceNew.setId(accountIdNew);
|
AccountResult resultNew = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
accountBalanceNew.setCompanyId(addresseeIdNew);
|
|
||||||
accountBalanceNew.setAccountId(accountIdNew);
|
|
||||||
accountBalanceNew.setAccountType(account.getAccountType());
|
|
||||||
accountBalanceNew.setAccount(account.getAccount());
|
|
||||||
accountBalanceNew.setOpenBalanceAmount(amountNew);
|
|
||||||
accountBalanceNew.setFreeBalanceAmount(amountNew);
|
|
||||||
accountBalanceNew.setBalanceAmount(amountNew);
|
|
||||||
accountBalanceNew.setBalanceAccountType(BalanceAccountType.Active.getKey());
|
|
||||||
accountBalanceNew.setCurrencyCode(cashMovementCurrencyCodeNew);
|
|
||||||
accountBalanceNew.setTradingCode(company.getTradingCode());
|
|
||||||
accountBalanceNew.setShortName(company.getShortName());
|
|
||||||
accountBalanceNew.setFullName(company.getFullName());
|
|
||||||
AccountResult predictableNewResult = new AccountResult(accountBalanceNew);
|
|
||||||
AccountResult resultNew = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
|
||||||
resultNew.getAccount().setId(accountIdNew);
|
resultNew.getAccount().setId(accountIdNew);
|
||||||
|
|
||||||
AccountBalance accountBalanceUpdate = new AccountBalance();
|
AccountBalance accountBalanceUpdate = new AccountBalance();
|
||||||
|
|
@ -101,10 +86,10 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
predictableResult = new AccountResult(new EnumMessage(BalanceError.CompanyNotFound));
|
predictableResult = new AccountResult(new EnumMessage(BalanceError.CompanyNotFound));
|
||||||
companyMap.delete(addresseeIdNew);
|
companyMap.delete(addresseeIdNew);
|
||||||
|
|
||||||
AccountResult result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
AccountResult result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
|
||||||
result = accountBalanceService.createAccountBalance(null, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
result = accountBalanceService.createAccountBalance(null, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
|
||||||
//AccountNotPresent accountType=null
|
//AccountNotPresent accountType=null
|
||||||
|
|
@ -115,7 +100,7 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
accountMap.put(accountIdNew, account);
|
accountMap.put(accountIdNew, account);
|
||||||
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
||||||
|
|
||||||
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
|
||||||
//AccountNotPresent id=null
|
//AccountNotPresent id=null
|
||||||
|
|
@ -125,7 +110,7 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
accountMap.put(accountIdNew, account);
|
accountMap.put(accountIdNew, account);
|
||||||
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
||||||
|
|
||||||
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
|
||||||
//AccountNotActive accountStatus=null
|
//AccountNotActive accountStatus=null
|
||||||
|
|
@ -135,12 +120,12 @@ class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||||
accountMap.put(accountIdNew, account);
|
accountMap.put(accountIdNew, account);
|
||||||
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotActive, account.getId()));
|
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotActive, account.getId()));
|
||||||
|
|
||||||
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCodeNew);
|
result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode);
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
|
||||||
account.setAccountStatus(Status.Active.getKey());
|
account.setAccountStatus(Status.Active.getKey());
|
||||||
accountMap.put(accountIdNew, account);
|
accountMap.put(accountIdNew, account);
|
||||||
result = accountBalanceService.createAccountBalance(addresseeIdNew, null, amountNew, cashMovementCurrencyCodeNew);
|
result = accountBalanceService.createAccountBalance(addresseeIdNew, null, amountNew, cashMovementCurrencyCode);
|
||||||
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent));
|
||||||
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,50 +3,86 @@ package ru.spcex.clearing.balance.service;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
|
import ru.clearing.classes.statics.data.account.AccountBalance;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||||
|
import ru.clearing.classes.statics.data.sdf.SDf02;
|
||||||
import ru.clearing.classes.statics.data.statement.Statement;
|
import ru.clearing.classes.statics.data.statement.Statement;
|
||||||
import ru.spcex.clearing.balance.utils.MatcherFactory;
|
import ru.spcex.clearing.balance.utils.MatcherFactory;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||||
|
import ru.spcex.platform.enumeration.OperationStatus;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||||
|
|
||||||
class Sdf01ExecutorTest extends AbstractServiceTest {
|
class Sdf01ExecutorTest extends AbstractServiceTest {
|
||||||
|
|
||||||
private static final MatcherFactory.Matcher<Result> SDF01_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
private static final MatcherFactory.Matcher<Result> RESULT_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
||||||
|
private static final MatcherFactory.Matcher<Statement> STATEMENT_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId");
|
||||||
|
private static final MatcherFactory.Matcher<SDf02> SDF_02_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId", "generationTime");
|
||||||
|
private static final MatcherFactory.Matcher<AccountBalance> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("created", "updated", "clearingDate");
|
||||||
|
|
||||||
private final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
private final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||||
private final Long id = currentId.getAndIncrement();
|
private final Long id = currentId.getAndIncrement();
|
||||||
@Autowired
|
@Autowired
|
||||||
Sdf01Executor sdf01Executor;
|
Sdf01Executor sdf01Executor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link Sdf01Executor#execute(Collection collection, StatementRequest statementRequest)}<br>
|
||||||
|
* Тест проверяет генерацию сущностей {@link Result}, {@link Statement}, {@link SDf02}<br>
|
||||||
|
* Входные параметры:<br>
|
||||||
|
* accountId - {@link StatementRequest}: new StatementRequest()<br>
|
||||||
|
* addresseeId - {@link Collection<SDf01>}<br>
|
||||||
|
* addresseeId - {@link SDf01}<br>
|
||||||
|
* {@link SDf01#market} - "U"<br>
|
||||||
|
* {@link SDf01#deal} - "111111111"<br>
|
||||||
|
* {@link SDf01#account} - "123456789"<br>
|
||||||
|
* {@link SDf01#curr_code} - "RUR"<br>
|
||||||
|
* {@link SDf01#dat} - текущая дата<br>
|
||||||
|
* {@link SDf01#acc_type} - "A"<br>
|
||||||
|
* {@link SDf01#remainder} - "1000"<br>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
void execute() {
|
void execute() {
|
||||||
//check create statement
|
//check create statement, SDf02 and AccountBalance
|
||||||
SDf01 sDf01 = new SDf01();
|
SDf01 sdf01 = new SDf01();
|
||||||
sDf01.setMarket("U");//!"U".equals
|
sdf01.setMarket("U");
|
||||||
sDf01.setDeal(deal);//tradingCode
|
sdf01.setDeal(deal);
|
||||||
sDf01.setAccount(acc);
|
sdf01.setAccount(acc);
|
||||||
sDf01.setCurr_code("RUR");
|
sdf01.setCurr_code("RUR");
|
||||||
sDf01.setDat(LocalDate.now().format(datFormatter));
|
sdf01.setDat(LocalDate.now().format(datFormatter));
|
||||||
sDf01.setAcc_type("A");
|
sdf01.setAcc_type("A");
|
||||||
|
sdf01.setRemainder(amountNew.toString());
|
||||||
|
|
||||||
Company company = getTestCompany();
|
Company company = getTestCompany();
|
||||||
companyMap.put(id, company);
|
companyMap.put(addresseeIdNew, company);
|
||||||
|
|
||||||
Account account = getTestAccount(id);
|
Account account = getTestAccount(id);
|
||||||
accountMap.put(id, account);
|
accountMap.put(accountIdNew, account);
|
||||||
|
|
||||||
StatementRequest statementRequest = new StatementRequest();
|
StatementRequest statementRequest = new StatementRequest();
|
||||||
|
|
||||||
Result predictableResult = new Result();
|
Result predictableResult = new Result();
|
||||||
predictableResult.setGenerationId(id);
|
predictableResult.setGenerationId(id);
|
||||||
Statement predictableStatement = new Statement();
|
Statement predictableStatement = getTestStatement(currentId.getAndIncrement(), company, account, sdf01);
|
||||||
Result result = sdf01Executor.execute(Collections.singletonList(sDf01), statementRequest);
|
predictableStatement.setOperationStatus(OperationStatus.Executed.getKey());
|
||||||
SDF01_MATCHER.assertMatch(result, predictableResult);
|
SDf02 predictableSdf02 = getTestSdf02(currentId.getAndIncrement(), sdf01, id);
|
||||||
|
predictableStatement.setOutSDfId(predictableSdf02.getId());
|
||||||
|
AccountResult predictableNewResult = getTestAccountResult(currentId.getAndIncrement(), account, company);
|
||||||
|
|
||||||
|
Result result = sdf01Executor.execute(Collections.singletonList(sdf01), statementRequest);
|
||||||
|
Statement resultStatement = statementImdg.getSingleObjectByFieldValues(Map.of("account", acc));
|
||||||
|
SDf02 resultSdf02 = sdf02Imdg.getSingleObjectByFieldValues(Map.of("account", acc));
|
||||||
|
AccountBalance resultAccountBalance = accountBalanceImdg.getSingleObjectByFieldValues(Map.of("account", acc));
|
||||||
|
|
||||||
|
RESULT_MATCHER.assertMatch(result, predictableResult);
|
||||||
|
STATEMENT_MATCHER.assertMatch(resultStatement, predictableStatement);
|
||||||
|
SDF_02_MATCHER.assertMatch(resultSdf02, predictableSdf02);
|
||||||
|
ACCOUNT_BALANCE_MATCHER.assertMatch(resultAccountBalance, predictableNewResult.getAccount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue