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();
}
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();
});
}
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();
}
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();
}
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();
});
}
Aggregations