Search in sources :

Example 11 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.

the class JdbcEntityTemplateIntegrationTests method replaceReferencedEntity.

// DATAJDBC-112
@Test
public void replaceReferencedEntity() {
    template.save(legoSet, LegoSet.class);
    Manual manual = new Manual(null);
    manual.setContent("other content");
    legoSet.setManual(manual);
    template.save(legoSet, LegoSet.class);
    LegoSet reloadedLegoSet = template.findById(legoSet.getId(), LegoSet.class);
    SoftAssertions softly = new SoftAssertions();
    softly.assertThat(reloadedLegoSet.manual.content).isEqualTo("other content");
    softly.assertThat(template.findAll(Manual.class)).describedAs("The should be only one manual").hasSize(1);
    softly.assertAll();
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 12 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.

the class SqlGeneratorContextBasedNamingStrategyUnitTests method findOne.

// DATAJDBC-107
@Test
public void findOne() {
    testAgainstMultipleUsers(user -> {
        SqlGenerator sqlGenerator = configureSqlGenerator(contextualNamingStrategy);
        String sql = sqlGenerator.getFindOne();
        SoftAssertions softAssertions = new SoftAssertions();
        // 
        softAssertions.assertThat(sql).startsWith(// 
        "SELECT").contains(// 
        user + ".DummyEntity.id AS id,").contains(// 
        user + ".DummyEntity.name AS name,").contains(// 
        "ref.l1id AS ref_l1id").contains(// 
        "ref.content AS ref_content").contains("FROM " + user + ".DummyEntity");
        softAssertions.assertAll();
    });
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 13 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.

the class SqlGeneratorFixedNamingStrategyUnitTests method findOneWithUppercasedTablesAndLowercasedColumns.

// DATAJDBC-107
@Test
public void findOneWithUppercasedTablesAndLowercasedColumns() {
    SqlGenerator sqlGenerator = configureSqlGenerator(upperCaseLowerCaseStrategy);
    String sql = sqlGenerator.getFindOne();
    SoftAssertions softAssertions = new SoftAssertions();
    // 
    softAssertions.assertThat(sql).startsWith(// 
    "SELECT").contains(// 
    "DUMMYENTITY.id AS id,").contains(// 
    "DUMMYENTITY.name AS name,").contains(// 
    "ref.l1id AS ref_l1id").contains(// 
    "ref.content AS ref_content").contains("FROM DUMMYENTITY");
    softAssertions.assertAll();
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 14 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.

the class SqlGeneratorUnitTests method findOne.

// DATAJDBC-112
@Test
public void findOne() {
    String sql = sqlGenerator.getFindOne();
    SoftAssertions softAssertions = new SoftAssertions();
    // 
    softAssertions.assertThat(sql).startsWith(// 
    "SELECT").contains(// 
    "DummyEntity.x_id AS x_id,").contains(// 
    "DummyEntity.x_name AS x_name,").contains(// 
    "ref.x_l1id AS ref_x_l1id").contains("ref.x_content AS ref_x_content").contains(// 
    " FROM DummyEntity").doesNotContain("Element AS elements");
    softAssertions.assertAll();
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 15 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.

the class JdbcRepositoryPropertyConversionIntegrationTests method saveAndLoadAnEntity.

// DATAJDBC-95
@Test
public void saveAndLoadAnEntity() {
    EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity());
    assertThat(repository.findById(entity.getIdTimestamp())).hasValueSatisfying(it -> {
        SoftAssertions softly = new SoftAssertions();
        softly.assertThat(it.getIdTimestamp()).isEqualTo(entity.getIdTimestamp());
        softly.assertThat(it.getSomeEnum()).isEqualTo(entity.getSomeEnum());
        softly.assertThat(it.getBigDecimal()).isEqualTo(entity.getBigDecimal());
        softly.assertThat(it.isBool()).isEqualTo(entity.isBool());
        softly.assertThat(it.getBigInteger()).isEqualTo(entity.getBigInteger());
        softly.assertThat(it.getDate()).is(representingTheSameAs(entity.getDate()));
        softly.assertThat(it.getLocalDateTime()).isEqualTo(entity.getLocalDateTime());
        softly.assertAll();
    });
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Aggregations

SoftAssertions (org.assertj.core.api.SoftAssertions)16 Test (org.junit.Test)15 FeedItem (gov.whitehouse.data.model.FeedItem)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 GfJsonArray (org.apache.geode.management.internal.cli.json.GfJsonArray)1 GfJsonObject (org.apache.geode.management.internal.cli.json.GfJsonObject)1 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)1 EventFactHandle (org.drools.core.common.EventFactHandle)1 KieSession (org.kie.api.runtime.KieSession)1 FactHandle (org.kie.api.runtime.rule.FactHandle)1 KieHelper (org.kie.internal.utils.KieHelper)1