org.assertj.core.api.IterableAssert Java Examples

The following examples show how to use org.assertj.core.api.IterableAssert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BalanceFileParserTest.java    From hedera-mirror-node with Apache License 2.0 5 votes vote down vote up
void assertAccountBalances(BalanceFile... balanceFiles) {
    IterableAssert<AccountBalanceSet> iterableAssert = assertThat(accountBalanceSetRepository.findAll())
            .hasSize(balanceFiles.length)
            .allMatch(abs -> abs.isComplete())
            .allMatch(abs -> abs.getProcessingEndTimestamp() != null)
            .allMatch(abs -> abs.getProcessingStartTimestamp() != null);

    for (BalanceFile balanceFile : balanceFiles) {
        iterableAssert.anyMatch(abs -> balanceFile.getConsensusTimestamp() == abs.getConsensusTimestamp() &&
                accountBalanceRepository.findByIdConsensusTimestamp(abs.getConsensusTimestamp()).size() ==
                        balanceFile.getCount());
    }
}
 
Example #2
Source File: TerminologyAssert.java    From termsuite-core with Apache License 2.0 5 votes vote down vote up
public IterableAssert<String> asMatchingRules() {
	Set<String> matchingRuleNames = Sets.newHashSet();
	for(Relation tv:actual.getRelations().stream().filter(r->r.getType() == RelationType.VARIATION).collect(toSet())) 
		matchingRuleNames.addAll(getVariationRules(tv));
	IterableAssert<String> assertThat = assertThat(matchingRuleNames);
	return assertThat;
}
 
Example #3
Source File: TerminologyAssert.java    From termsuite-core with Apache License 2.0 5 votes vote down vote up
public IterableAssert<Term> asCompoundList() {
	Set<Term> comouponds = actual.getTerms().values().stream()
		.filter(t-> t.getWords().size() == 1 && t.getWords().get(0).getWord().isCompound())
		.collect(toSet());
	IterableAssert<Term> assertThat = assertThat(comouponds);
	return assertThat;
}
 
Example #4
Source File: TerminologyAssert.java    From termsuite-core with Apache License 2.0 5 votes vote down vote up
public IterableAssert<Relation> asTermVariations(RelationType ralType, RelationType... ralTypes) {
	EnumSet<RelationType> accepted = EnumSet.of(ralType, ralTypes);
	Set<Relation> relations = actual.getRelations().stream()
			.filter(r-> accepted.contains(r.getType()))
			.collect(toSet());
	return assertThat(
			relations);
}
 
Example #5
Source File: TerminologyAssert.java    From termsuite-core with Apache License 2.0 5 votes vote down vote up
public IterableAssert<Relation> asTermVariationsHavingRule(String ruleName) {
	Set<Relation> variations = Sets.newHashSet();
	for(Relation v:actual.getRelations()) {
		if(getVariationRules(v).contains(ruleName))
			variations.add(v);
		
	}
	return assertThat(variations);
}
 
Example #6
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
public void eventRegistryWithKafka() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.class))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
Example #7
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
public void eventRegistryWithRabbit() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(RabbitAutoConfiguration.class))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors())
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
Example #8
Source File: TerminologyAssert.java    From termsuite-core with Apache License 2.0 4 votes vote down vote up
public IterableAssert<Relation> getVariations(Term base) {
	return assertThat(UnitTests.outRels(actual, base));
}
 
Example #9
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Test
public void eventRegistryWithCustomDefinitionProcessors() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class
        ))
        .withUserConfiguration(CustomChannelDefinitionProcessorsConfiguration.class)
        .run(context -> {
            assertThat(context)
                .doesNotHaveBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor")
                .doesNotHaveBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor")
                .doesNotHaveBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor")
                .hasBean("customChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());
            channelModelProcessorAssert
                .hasSize(8);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("customChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(2)
                .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

        channelModelProcessorAssert
                .element(3)
                .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(5)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(6)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(7)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
Example #10
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Test
public void eventRegistryWithJmsRabbitAndKafka() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class
        ))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor")
                .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor")
                .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());
            channelModelProcessorAssert
                .hasSize(7)
                .contains(
                    context.getBean("jmsChannelDefinitionProcessor", JmsChannelModelProcessor.class),
                    context.getBean("rabbitChannelDefinitionProcessor", RabbitChannelDefinitionProcessor.class),
                    context.getBean("kafkaChannelDefinitionProcessor", KafkaChannelDefinitionProcessor.class)
                );

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(5)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(6)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
Example #11
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Test
public void eventRegistryWithJms() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class
        ))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();

            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);

        });
}
 
Example #12
Source File: EventRegistryAutoConfigurationTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Test
public void standaloneEventRegistryWithBasicDataSource() {
    contextRunner.run(context -> {
        assertThat(context)
            .doesNotHaveBean(AppEngine.class)
            .doesNotHaveBean(ProcessEngine.class)
            .doesNotHaveBean(ChannelModelProcessor.class)
            .doesNotHaveBean("eventProcessEngineConfigurationConfigurer")
            .doesNotHaveBean("eventAppEngineConfigurationConfigurer");
        EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
        assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
        assertAllServicesPresent(context, eventRegistryEngine);

        IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
            eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

        channelModelProcessorAssert
            .hasSize(4);

        channelModelProcessorAssert
            .element(0)
            .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(1)
            .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(2)
            .isInstanceOf(InboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(3)
            .isInstanceOf(OutboundChannelModelProcessor.class);

        assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
            .getBean(CustomUserEngineConfigurerConfiguration.class)
            .satisfies(configuration -> {
                assertThat(configuration.getInvokedConfigurations())
                    .containsExactly(
                        SpringEventRegistryEngineConfiguration.class
                    );
            });

    });
}
 
Example #13
Source File: TestListResolverAssert.java    From smart-testing with Apache License 2.0 4 votes vote down vote up
public IterableAssert<ResolvedTest> excludedPatterns() {
    isNotNull();

    return Assertions.assertThat(actual.getExcludedPatterns());
}
 
Example #14
Source File: TestListResolverAssert.java    From smart-testing with Apache License 2.0 4 votes vote down vote up
public IterableAssert<ResolvedTest> includedPatterns() {
    isNotNull();

    return Assertions.assertThat(actual.getIncludedPatterns());
}
 
Example #15
Source File: MappingRuleAssert.java    From doov with Apache License 2.0 4 votes vote down vote up
public MappingRuleAssert isNotUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.doesNotContain(fieldIds);
    return this;
}
 
Example #16
Source File: MappingRuleAssert.java    From doov with Apache License 2.0 4 votes vote down vote up
public MappingRuleAssert isUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.contains(fieldIds);
    return this;
}
 
Example #17
Source File: ValidationRuleAssert.java    From doov with Apache License 2.0 4 votes vote down vote up
public ValidationRuleAssert isNotUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.doesNotContain(fieldIds);
    return this;
}
 
Example #18
Source File: ValidationRuleAssert.java    From doov with Apache License 2.0 4 votes vote down vote up
public ValidationRuleAssert isUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.contains(fieldIds);
    return this;
}