diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java index 976cc2b3a..eb6e63118 100644 --- a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java @@ -17,8 +17,9 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.account.BankAccount; +import ru.spcex.clearing.account.config.ErrorResolverConfig; import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; -import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.config.ValidationConfig; import ru.spcex.clearing.account.utils.ImapEvent; import ru.spcex.clearing.account.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; @@ -29,12 +30,14 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewReq import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdateRequest; import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; +import ru.spcex.platform.utils.enumeration.IMessageResolver; +import ru.spcex.platform.utils.validation.IValidator; import java.util.Collections; import java.util.HashMap; +import java.util.function.Function; import static org.junit.jupiter.api.Assertions.assertTrue; -import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @@ -47,22 +50,25 @@ public class BankAccountServiceTest { private static final String TOPIC_ACCOUNT_NEW = Consts.DESTINATION_BANK_ACCOUNT_NEW; private static final String TOPIC_ACCOUNT_UPDATE = Consts.DESTINATION_BANK_ACCOUNT_UPDATE; private static final String TOPIC_ACCOUNT_DELETE = Consts.DESTINATION_BANK_ACCOUNT_DELETE; - private static final Long ID = currentID.getAndIncrement(); + private static final Long ID = 0L; @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; - private MockConsumer mockConsumer; + @Autowired + private IMessageResolver messageResolver; @Autowired - @Qualifier("mockProducerTest") - private MockProducer mockProducer; + private Function bankAccountNewRequestValidator; + private MockConsumer mockConsumer; + private MockProducer mockProducer; @BeforeEach void setUp() { mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST); + mockProducer = new MockProducer<>(); } /** @@ -118,9 +124,10 @@ public class BankAccountServiceTest { //ACT hazelcastServiceTest.waitTillReadyState(); //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet(); + //KAFKA mockConsumer.schedulePollTask(() -> { mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); @@ -213,8 +220,7 @@ public class BankAccountServiceTest { hazelcastServiceTest.waitTillReadyState(); //service set up BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, - hazelcastServiceTest, messageResolver, - bankAccountNewRequestValidator); + hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet(); @@ -280,8 +286,7 @@ public class BankAccountServiceTest { //service set up hazelcastServiceTest.waitTillReadyState(); BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, - hazelcastServiceTest, messageResolver, - bankAccountNewRequestValidator); + hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet();