当前位置: 首页>>代码示例>>Java>>正文


Java SoftAssertions类代码示例

本文整理汇总了Java中org.assertj.core.api.SoftAssertions的典型用法代码示例。如果您正苦于以下问题:Java SoftAssertions类的具体用法?Java SoftAssertions怎么用?Java SoftAssertions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SoftAssertions类属于org.assertj.core.api包,在下文中一共展示了SoftAssertions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldAddTags

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
void shouldAddTags() {
    runClasses(TaggedTests.class);

    final List<TestResult> testResults = results.getTestResults();

    SoftAssertions softly = new SoftAssertions();

    softly.assertThat(testResults)
            .hasSize(1);

    softly.assertThat(testResults)
            .flatExtracting(TestResult::getLabels)
            .filteredOn(label -> "tag".equals(label.getName()))
            .flatExtracting(Label::getValue)
            .containsExactlyInAnyOrder(CLASS_TAG, METHOD_TAG);

    softly.assertAll();
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:20,代码来源:AllureJunit5Test.java

示例2: applyCollectionTypes

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void applyCollectionTypes() throws Exception {
    SoftAssertions softly = new SoftAssertions();

    softly.assertThat(lookup.apply(
            CollectionFields.class.getDeclaredField("stringList").getGenericType())
    ).isEqualTo(IndexType.TEXT);

    softly.assertThat(lookup.apply(
            CollectionFields.class.getDeclaredField("integerSet").getGenericType())
    ).isEqualTo(IndexType.NUMBER);

    softly.assertThat(lookup.apply(
            CollectionFields.class.getDeclaredField("stringArray").getGenericType())
    ).isEqualTo(IndexType.TEXT);

    softly.assertThat(lookup.apply(
            CollectionFields.class.getDeclaredField("intArray").getGenericType())
    ).isEqualTo(IndexType.NUMBER);

    softly.assertAll();
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:23,代码来源:IndexTypeRegistryTest.java

示例3: verifyTestEntityCollectionSaved

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@SuppressWarnings("Duplicates")
protected void verifyTestEntityCollectionSaved() {
    SoftAssertions softly = new SoftAssertions();

    TestLongEntity loaded1 = load(1L);
    softly.assertThat(loaded1.getId()).isEqualTo(1L);
    softly.assertThat(loaded1.getName()).isEqualTo("entity1");

    TestLongEntity loaded2 = load(2L);
    softly.assertThat(loaded2.getId()).isEqualTo(2L);
    softly.assertThat(loaded2.getName()).isEqualTo("entity2");

    TestLongEntity loaded3 = load(3L);
    softly.assertThat(loaded3.getId()).isEqualTo(3L);
    softly.assertThat(loaded3.getName()).isEqualTo("entity3");

    softly.assertAll();
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:19,代码来源:LongAsyncSaveRepositoryTest.java

示例4: verifyTestEntityCollectionSaved

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@SuppressWarnings("Duplicates")
protected void verifyTestEntityCollectionSaved() {
    SoftAssertions softly = new SoftAssertions();

    TestStringEntity loaded1 = load("id1");
    softly.assertThat(loaded1.getId()).isEqualTo("id1");
    softly.assertThat(loaded1.getName()).isEqualTo("entity1");

    TestStringEntity loaded2 = load("id2");
    softly.assertThat(loaded2.getId()).isEqualTo("id2");
    softly.assertThat(loaded2.getName()).isEqualTo("entity2");

    TestStringEntity loaded3 = load("id3");
    softly.assertThat(loaded3.getId()).isEqualTo("id3");
    softly.assertThat(loaded3.getName()).isEqualTo("entity3");

    softly.assertAll();
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:19,代码来源:StringAsyncSaveRepositoryTest.java

示例5: verifyTestEntityCollectionSaved

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
protected void verifyTestEntityCollectionSaved() {
    SoftAssertions softly = new SoftAssertions();

    TestLongEntity loaded1 = load(1L);
    softly.assertThat(loaded1.getId()).isEqualTo(1L);
    softly.assertThat(loaded1.getName()).isEqualTo("entity1");

    TestLongEntity loaded2 = load(2L);
    softly.assertThat(loaded2.getId()).isEqualTo(2L);
    softly.assertThat(loaded2.getName()).isEqualTo("entity2");

    TestLongEntity loaded3 = load(3L);
    softly.assertThat(loaded3.getId()).isEqualTo(3L);
    softly.assertThat(loaded3.getName()).isEqualTo("entity3");

    softly.assertAll();
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:18,代码来源:LongAsyncDeleteRepositoryTest.java

示例6: test_lineSeparator_suffix

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void test_lineSeparator_suffix() {

    // Create the log event.
    SimpleMessage message = new SimpleMessage("Hello, World!");
    LogEvent logEvent = Log4jLogEvent
            .newBuilder()
            .setLoggerName(LogstashLayoutTest.class.getSimpleName())
            .setLevel(Level.INFO)
            .setMessage(message)
            .build();

    // Check line separators.
    SoftAssertions assertions = new SoftAssertions();
    test_lineSeparator_suffix(logEvent, true, assertions);
    test_lineSeparator_suffix(logEvent, false, assertions);
    assertions.assertAll();

}
 
开发者ID:vy,项目名称:log4j2-logstash-layout,代码行数:20,代码来源:LogstashLayoutTest.java

示例7: equals

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void equals() {
    final Participation p = mock();
    final ParticipationDescriptor d = new ParticipationDescriptor(p);
    final RecommendedParticipation r = new RecommendedParticipation(d);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(r).isNotEqualTo(null);
        softly.assertThat(r).isNotEqualTo(UUID.randomUUID().toString());
        softly.assertThat(r).isEqualTo(r);
    });
    final RecommendedParticipation r2 = new RecommendedParticipation(d);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(r).isEqualTo(r2);
        softly.assertThat(r2).isEqualTo(r);
    });
    final RecommendedParticipation r3 = new RecommendedParticipation(new ParticipationDescriptor(mock()));
    Assertions.assertThat(r).isNotEqualTo(r3);
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:19,代码来源:RecommendedParticipationTest.java

示例8: coreWithTweaks

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void coreWithTweaks() {
    // prepare
    final InstallData localData = RoboZonkyInstallerListenerTest.mockData();
    Mockito.when(localData.getVariable(Variables.IS_DRY_RUN.getKey())).thenReturn("true");
    Mockito.when(localData.getVariable(Variables.IS_ZONKOID_ENABLED.getKey())).thenReturn("true");
    Mockito.when(localData.getVariable(Variables.ZONKOID_TOKEN.getKey())).thenReturn("123456");
    RoboZonkyInstallerListener.setInstallData(localData);
    // execute SUT
    final CommandLinePart clp = new RoboZonkyInstallerListener().prepareCore();
    // test
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(clp.getOptions())
                .containsKey("-d")
                .containsKey("-x");
        softly.assertThat(clp.getOptions().get("-p"))
                .containsOnly(String.valueOf(RoboZonkyInstallerListener.KEYSTORE_PASSWORD));
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:RoboZonkyInstallerListenerTest.java

示例9: equals

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void equals() {
    final Investment i = mock();
    final InvestmentDescriptor d = new InvestmentDescriptor(i);
    final RecommendedInvestment r = new RecommendedInvestment(d);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(r).isNotEqualTo(null);
        softly.assertThat(r).isNotEqualTo(UUID.randomUUID().toString());
        softly.assertThat(r).isEqualTo(r);
    });
    final RecommendedInvestment r2 = new RecommendedInvestment(d);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(r).isEqualTo(r2);
        softly.assertThat(r2).isEqualTo(r);
    });
    final RecommendedInvestment r3 = new RecommendedInvestment(new InvestmentDescriptor(mock()));
    Assertions.assertThat(r).isNotEqualTo(r3);
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:19,代码来源:RecommendedInvestmentTest.java

示例10: testAliasWithIgnore

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void testAliasWithIgnore() {
    SqlTable table = SqlTable.of("foo");
    SqlColumn<Integer> column = table.column("id", JDBCType.INTEGER);
    
    IsEqualTo<Integer> condition = IsEqualTo.of(() -> 3);
    SqlCriterion<Integer> criterion = SqlCriterion.withColumn(column)
            .withCondition(condition)
            .build();
    AtomicInteger sequence = new AtomicInteger(1);
    FragmentAndParameters fp = CriterionRenderer.withCriterion(criterion)
            .withSequence(sequence)
            .withRenderingStrategy(RenderingStrategy.MYBATIS3)
            .withTableAliasCalculator(TableAliasCalculator.empty())
            .build()
            .render();
    
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(fp.fragment()).isEqualTo("id = #{parameters.p1,jdbcType=INTEGER}");
        softly.assertThat(fp.parameters().size()).isEqualTo(1);
    });
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:23,代码来源:CriterionRendererTest.java

示例11: equals

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void equals() {
    final Investment i = mock(BigDecimal.TEN);
    final InvestmentDescriptor id = new InvestmentDescriptor(i);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(id).isNotEqualTo(null);
        softly.assertThat(id).isNotEqualTo(UUID.randomUUID().toString());
        softly.assertThat(id).isEqualTo(id);
    });
    final InvestmentDescriptor id2 = new InvestmentDescriptor(i);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(id).isEqualTo(id2);
        softly.assertThat(id2).isEqualTo(id);
    });
    final InvestmentDescriptor id3 = new InvestmentDescriptor(mock(BigDecimal.ONE));
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(id).isNotEqualTo(id3);
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:InvestmentDescriptorTest.java

示例12: assertFullyPopulated

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
private void assertFullyPopulated(SoftAssertions assertions, Person person, String breadcrumb, int level) {
    logger.trace("[{}] Checking {}", level, breadcrumb);
    assertions.assertThat(person).as(breadcrumb + " at level " + level).isNotNull();
    if (person == null) {
        return;
    }
    assertions.assertThat(person.getAnnualSalary()).as(breadcrumb + ".annualSalary at level " + level).isNotNull();
    assertions.assertThat(person.getBirthday()).as(breadcrumb + ".birthday at level " + level).isNotNull();
    assertions.assertThat(person.getName()).as(breadcrumb + ".name at level " + level).isNotNull();
    assertions.assertThat(person.getPreferredColor()).as(breadcrumb + ".preferredColor at level " + level).isNotNull();
    assertions.assertThat(person.getAlwaysNullValue()).as(breadcrumb + ".awaysNullValue at level " + level).isNull();
    assertions.assertThat(person.getSingleValue()).as(breadcrumb + ".singleValue at level " + level).isSameAs(SingleValueEnum.SINGLE_VALUE);
    if (level > 0) {
        assertFullyPopulated(assertions, person.getManager(), breadcrumb + ".manager", level - 1);

        String teamProperty = breadcrumb + ".team at level " + level;
        assertions.assertThat(person.getTeam()).as(teamProperty).isNotNull();
        if (person.getTeam() != null) {
            for (Person teamMember : person.getTeam()) {
                assertFullyPopulated(assertions, teamMember, teamProperty, level - 1);
            }
        }
    }
}
 
开发者ID:chrisgleissner,项目名称:behaim,代码行数:25,代码来源:BehaimTest.java

示例13: defaultProperties

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void defaultProperties() {
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(Settings.INSTANCE.get("user.dir", "")).isNotEqualTo("");
        softly.assertThat(Settings.INSTANCE.get(UUID.randomUUID().toString(), ""))
                .isEqualTo("");
        softly.assertThat(Settings.INSTANCE.isDebugEventStorageEnabled()).isFalse();
        softly.assertThat(Settings.INSTANCE.getTokenRefreshPeriod())
                .matches(new SettingsTest.TemporalPredicate(60));
        softly.assertThat(Settings.INSTANCE.getRemoteResourceRefreshInterval())
                .matches(new SettingsTest.TemporalPredicate(5 * 60));
        softly.assertThat(Settings.INSTANCE.getCaptchaDelay())
                .matches(new SettingsTest.TemporalPredicate(0));
        Stream.of(Rating.values()).forEach(r -> {
            softly.assertThat(Settings.INSTANCE.getCaptchaDelay(r))
                    .as(r.toString())
                    .matches(new SettingsTest.TemporalPredicate(0));
        });
        softly.assertThat(Settings.INSTANCE.getDefaultDryRunBalance()).isEqualTo(-1);
        softly.assertThat(Settings.INSTANCE.getSocketTimeout())
                .matches(new SettingsTest.TemporalPredicate(60));
        softly.assertThat(Settings.INSTANCE.getConnectionTimeout())
                .matches(new SettingsTest.TemporalPredicate(60));
        softly.assertThat(Settings.INSTANCE.getDefaultApiPageSize()).isEqualTo(100);
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:27,代码来源:SettingsTest.java

示例14: windows

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void windows() throws IOException {
    final File optionsFile = getTempFile().getAbsoluteFile();
    final File root = optionsFile.getParentFile();
    final CommandLinePart cli = getCommandLine();
    final Function<CommandLinePart, File> generator =
            RunScriptGenerator.forWindows(root, optionsFile);
    final String result = new String(Files.readAllBytes(generator.apply(cli).toPath()));
    common(cli, result);
    Assertions.assertThat(result)
            .as("Missing executable file call.")
            .contains(root + "\\robozonky.bat @" + optionsFile.getAbsolutePath());
    // assert all environment variables present
    SoftAssertions.assertSoftly(softly -> cli.getEnvironmentVariables().forEach((var, value) -> {
        final String arg = var + "=" + value;
        softly.assertThat(result).as("Missing env var.").contains(arg);
    }));
    Assertions.assertThat(result).contains("\r\n");
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:RunScriptGeneratorTest.java

示例15: testTypeHandlerAndAlias

import org.assertj.core.api.SoftAssertions; //导入依赖的package包/类
@Test
public void testTypeHandlerAndAlias() {
    SqlTable table = SqlTable.of("foo");
    SqlColumn<Integer> column = table.column("id", JDBCType.INTEGER, "foo.Bar");
    IsEqualTo<Integer> condition = IsEqualTo.of(() -> 3);
    SqlCriterion<Integer> criterion = SqlCriterion.withColumn(column)
            .withCondition(condition)
            .build();
    AtomicInteger sequence = new AtomicInteger(1);
    Map<SqlTable, String> tableAliases = new HashMap<>();
    tableAliases.put(table, "a");
    
    FragmentAndParameters fp = CriterionRenderer.withCriterion(criterion)
            .withSequence(sequence)
            .withRenderingStrategy(RenderingStrategy.MYBATIS3)
            .withTableAliasCalculator(TableAliasCalculator.of(tableAliases))
            .build()
            .render();
    
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(fp.fragment()).isEqualTo("a.id = #{parameters.p1,jdbcType=INTEGER,typeHandler=foo.Bar}");
        softly.assertThat(fp.parameters().size()).isEqualTo(1);
    });
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:25,代码来源:CriterionRendererTest.java


注:本文中的org.assertj.core.api.SoftAssertions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。