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


Java SoftAssertions.assertSoftly方法代码示例

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


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

示例1: testNotInSubSelect

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testNotInSubSelect() {
    Date d = new Date();

    SelectStatementProvider selectStatement = select(column1.as("A_COLUMN1"), column2)
            .from(table, "a")
            .where(column2, isNotIn(select(column2).from(table).where(column2, isEqualTo(3))))
            .and(column1, isLessThan(d))
            .build()
            .render(RenderingStrategy.MYBATIS3);
    

    SoftAssertions.assertSoftly(softly -> {
        String expectedFullStatement = "select a.column1 as A_COLUMN1, a.column2 "
                + "from foo a "
                + "where a.column2 not in (select column2 from foo where column2 = #{parameters.p1,jdbcType=INTEGER})"
                + " and a.column1 < #{parameters.p2,jdbcType=DATE}";

        softly.assertThat(selectStatement.getSelectStatement()).isEqualTo(expectedFullStatement);

        Map<String, Object> parameters = selectStatement.getParameters();
        softly.assertThat(parameters.get("p1")).isEqualTo(3);
        softly.assertThat(parameters.get("p2")).isEqualTo(d);
    });
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:26,代码来源:SubSelectTest.java

示例2: environmentVariables

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void environmentVariables() {
    final String firstVariable = UUID.randomUUID().toString();
    final String secondVariable = UUID.randomUUID().toString();
    final String firstValue = UUID.randomUUID().toString();
    final String secondValue = UUID.randomUUID().toString();
    final CommandLinePart clp = new CommandLinePart()
            .setEnvironmentVariable(firstVariable, firstValue)
            .setEnvironmentVariable(secondVariable, secondValue);
    SoftAssertions.assertSoftly(softly -> {
        final Map<String, String> variables = clp.getEnvironmentVariables();
        softly.assertThat(variables.get(UUID.randomUUID().toString())).isNull();
        softly.assertThat(variables.get(firstVariable)).isSameAs(firstValue);
        softly.assertThat(variables.get(secondVariable)).isSameAs(secondValue);
        softly.assertThat(clp.getJvmArguments()).isEmpty();
        softly.assertThat(clp.getOptions()).isEmpty();
        softly.assertThat(clp.getProperties()).isEmpty();
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:CommandLinePartTest.java

示例3: testSum

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testSum() {
    SqlSession sqlSession = sqlSessionFactory.openSession();
    try {
        AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
        
        SelectStatementProvider selectStatement = select(sum(brainWeight).as("total"))
                .from(animalData)
                .build()
                .render(RenderingStrategy.MYBATIS3);
        
        SoftAssertions.assertSoftly(softly -> {
            softly.assertThat(selectStatement.getSelectStatement()).isEqualTo("select sum(brain_weight) as total from AnimalData");
        
            Double total = mapper.selectADouble(selectStatement);
            softly.assertThat(total).isEqualTo(120424.97, within(.01));
        });
    } finally {
        sqlSession.close();
    }
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:22,代码来源:AnimalDataTest.java

示例4: unix

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void unix() throws IOException {
    final File optionsFile = getTempFile().getAbsoluteFile();
    final File root = optionsFile.getParentFile();
    final CommandLinePart cli = getCommandLine();
    final Function<CommandLinePart, File> generator =
            RunScriptGenerator.forUnix(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.sh @" + 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).doesNotContain("\r\n");
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:RunScriptGeneratorTest.java

示例5: testOrderByMultipleColumns

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testOrderByMultipleColumns() {
    Date d = new Date();

    SelectStatementProvider selectStatement = select(column1.as("A_COLUMN1"), column2)
            .from(table, "a")
            .where(column1, isEqualTo(d))
            .orderBy(column2.descending(), column1)
            .build()
            .render(RenderingStrategy.MYBATIS3);

    SoftAssertions.assertSoftly(softly -> {
        String expectedFullStatement = "select a.column1 as A_COLUMN1, a.column2 "
                + "from foo a "
                + "where a.column1 = #{parameters.p1,jdbcType=DATE} "
                + "order by column2 DESC, column1";

        softly.assertThat(selectStatement.getSelectStatement()).isEqualTo(expectedFullStatement);
    
        Map<String, Object> parameters = selectStatement.getParameters();
        softly.assertThat(parameters.get("p1")).isEqualTo(d);
    });
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:24,代码来源:SelectStatementTest.java

示例6: withActiveDelinquency

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void withActiveDelinquency() {
    final LocalDate since = LocalDate.now();
    final int loanId = 1;
    final Delinquent d = new Delinquent(loanId, since);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(d.getLoanId()).isEqualTo(loanId);
        softly.assertThat(d.getActiveDelinquency()).isPresent();
        softly.assertThat(d.hasActiveDelinquency()).isTrue();
        softly.assertThat(d.getDelinquencies()).hasSize(1);
    });
    final Delinquency active = d.getDelinquencies().findFirst().get();
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(active.getParent()).isEqualTo(d);
        softly.assertThat(active.getPaymentMissedDate()).isEqualTo(since);
        softly.assertThat(active.getFixedOn()).isEmpty();
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:19,代码来源:DelinquentTest.java

示例7: testFullUpdateStatement

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testFullUpdateStatement() {
    UpdateStatementProvider updateStatement = update(foo)
            .set(firstName).equalTo("fred")
            .set(lastName).equalTo("jones")
            .set(occupation).equalToNull()
            .where(id, isEqualTo(3))
            .build()
            .render(RenderingStrategy.MYBATIS3);
    
    String expectedStatement = "update foo " 
            + "set firstName = #{parameters.p1,jdbcType=VARCHAR}, lastName = #{parameters.p2,jdbcType=VARCHAR}, occupation = null "
            + "where id = #{parameters.p3,jdbcType=INTEGER}";
            
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(updateStatement.getUpdateStatement()).isEqualTo(expectedStatement);
    
        softly.assertThat(updateStatement.getParameters().size()).isEqualTo(3);
        softly.assertThat(updateStatement.getParameters().get("p1")).isEqualTo("fred");
        softly.assertThat(updateStatement.getParameters().get("p2")).isEqualTo("jones");
        softly.assertThat(updateStatement.getParameters().get("p3")).isEqualTo(3);
    });
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:24,代码来源:UpdateStatementTest.java

示例8: 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

示例9: empty

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void empty() {
    final EntitySpliterator<Loan> e = new EntitySpliterator<>(Collections.emptyList());
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(e.hasCharacteristics(Spliterator.IMMUTABLE)).isTrue(); // no way to add data
        softly.assertThat(e.hasCharacteristics(Spliterator.NONNULL)).isTrue();
        softly.assertThat(e.hasCharacteristics(Spliterator.SIZED)).isTrue();
        softly.assertThat(e.hasCharacteristics(Spliterator.DISTINCT)).isFalse();
        softly.assertThat(e.hasCharacteristics(Spliterator.CONCURRENT)).isFalse();
    });
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(e.trySplit()).isSameAs(Spliterators.emptySpliterator());
        softly.assertThat(e.getExactSizeIfKnown()).isEqualTo(0);
        softly.assertThat(e.tryAdvance(null)).isFalse();
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:17,代码来源:EntitySpliteratorTest.java

示例10: testAddNewReportToTestMethodReport

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testAddNewReportToTestMethodReport() throws Exception {
    TestMethodReport testMethodReport = ReportGeneratorUtils
        .prepareReport(TestMethodReport.class, TEST_METHOD_NAME, 1, 5);

    // add configuration report - should be added into list of configs
    ConfigurationReport configurationReportToAdd =
        ReportGeneratorUtils.prepareReport(ConfigurationReport.class, "method config", 5, 10);
    testMethodReport.addNewReport(configurationReportToAdd, ConfigurationReport.class);

    // add failur method report - should be added into list of failures
    FailureReport failureReportToAdd = ReportGeneratorUtils
        .prepareReport(FailureReport.class, "test method failure", 3, 8);
    testMethodReport.addNewReport(failureReportToAdd, FailureReport.class);

    // add a normal report - should be added into List of subReports
    BasicReport basicReport = ReportGeneratorUtils.prepareReport(BasicReport.class, "report", 5, 10);
    testMethodReport.addNewReport(basicReport, BasicReport.class);

    // verify
    SoftAssertions.assertSoftly(softly -> {
        assertThatTestMethodReport(testMethodReport)
            .hasName(TEST_METHOD_NAME)
            .hasConfigSubReportsContainingExactly(configurationReportToAdd)
            .hasFailureSubReportsContainingExactly(failureReportToAdd)
            .hasSubReportsWithout(configurationReportToAdd, failureReportToAdd)
            .hasSubReportsEndingWith(basicReport)
            .hasGeneratedSubReportsAndEntries(1, 5)
            .hasNumberOfSubReports(5)
            .hasNumberOfEntries(4);
    });
}
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:33,代码来源:TestMethodTest.java

示例11: construct

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void construct() {
    final DefaultPortfolio p = DefaultPortfolio.BALANCED;
    final DefaultValues sut = new DefaultValues(p);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(sut.getPortfolio()).isSameAs(p);
        softly.assertThat(sut.getInvestmentSize().getMinimumInvestmentInCzk()).isEqualTo(0);
        softly.assertThat(sut.needsConfirmation(Mockito.mock(Loan.class))).isFalse();
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:11,代码来源:DefaultValuesTest.java

示例12: testUpdateByExample

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void testUpdateByExample() {
    SqlSession session = sqlSessionFactory.openSession();
    try {
        GeneratedAlwaysAnnotatedMapper mapper = session.getMapper(GeneratedAlwaysAnnotatedMapper.class);
        GeneratedAlwaysRecord record = new GeneratedAlwaysRecord();
        record.setId(100);
        record.setFirstName("Joe");
        record.setLastName("Jones");
        
        int rows = mapper.insert(buildInsert(record));
        assertThat(rows).isEqualTo(1);

        GeneratedAlwaysRecord updateRecord = new GeneratedAlwaysRecord();
        updateRecord.setId(100);
        updateRecord.setLastName("Smith");
        rows = mapper.update(buildUpdateByPrimaryKeySelectiveStatement(updateRecord));
        assertThat(rows).isEqualTo(1);
        
        GeneratedAlwaysRecord newRecord = mapper.selectByPrimaryKey(selectByPrimaryKey(100));
        SoftAssertions.assertSoftly(softly -> {
            softly.assertThat(newRecord.getFirstName()).isEqualTo("Joe");
            softly.assertThat(newRecord.getLastName()).isEqualTo("Smith");
            softly.assertThat(newRecord.getFullName()).isEqualTo("Joe Smith");
        });
    } finally {
        session.close();
    }
}
 
开发者ID:mybatis,项目名称:mybatis-dynamic-sql,代码行数:30,代码来源:GeneratedAlwaysAnnotatedMapperTest.java

示例13: modeProcessed

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void modeProcessed() throws Exception {
    final AtomicBoolean faultTolerant = new AtomicBoolean(false);
    final InvestmentMode mode = Mockito.mock(InvestmentMode.class);
    Mockito.when(mode.get()).thenReturn(ReturnCode.ERROR_SETUP);
    Mockito.when(mode.isFaultTolerant()).thenReturn(!faultTolerant.get());
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(App.execute(mode, faultTolerant)).isEqualTo(ReturnCode.ERROR_SETUP);
        softly.assertThat(faultTolerant.get()).isTrue();
        softly.assertThat(App.SHUTDOWN_HOOKS.getRegisteredCount()).isGreaterThanOrEqualTo(3);
    });
    Mockito.verify(mode).close();
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:14,代码来源:AppTest.java

示例14: shares

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void shares() {
    final DefaultPortfolio portfolio = DefaultPortfolio.EMPTY;
    final DefaultValues values = new DefaultValues(portfolio);
    final PortfolioShare share = new PortfolioShare(Rating.D, 50, 100);
    final ParsedStrategy strategy = new ParsedStrategy(values, Collections.singleton(share),
                                                       Collections.emptyMap());
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(strategy.getMinimumShare(Rating.D)).isEqualTo(50);
        softly.assertThat(strategy.getMaximumShare(Rating.D)).isEqualTo(100);
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:13,代码来源:ParsedStrategyTest.java

示例15: equality

import org.assertj.core.api.SoftAssertions; //导入方法依赖的package包/类
@Test
public void equality() {
    final Ratings r1 = Ratings.of(Rating.A, Rating.B);
    Assertions.assertThat(r1)
            .isSameAs(r1)
            .isEqualTo(r1)
            .isNotEqualTo(null)
            .isNotEqualTo(this.getClass());
    final Ratings r2 = Ratings.of(Rating.A, Rating.B);
    SoftAssertions.assertSoftly(softly -> {
        softly.assertThat(r1).isNotSameAs(r2).isEqualTo(r2);
        softly.assertThat(r2).isEqualTo(r1);
    });
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:15,代码来源:RatingsTest.java


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