use of org.assertj.core.api.SoftAssertions in project geode by apache.
the class DataCommandFunctionWithPDXJUnitTest method assertThatRowIsBuiltCorrectly.
private void assertThatRowIsBuiltCorrectly(GfJsonObject table, int rowNum, Customer customer) throws Exception {
SoftAssertions softly = new SoftAssertions();
String id = (String) table.getJSONArray("id").get(rowNum);
String firstName = (String) table.getJSONArray("firstName").get(rowNum);
String lastName = (String) table.getJSONArray("lastName").get(rowNum);
softly.assertThat(id).describedAs("Customer ID").isEqualTo(customer.id);
softly.assertThat(firstName).describedAs("First name").isEqualTo(customer.firstName);
softly.assertThat(lastName).describedAs("Last name").isEqualTo(customer.lastName);
GfJsonArray phoneArray = table.getJSONArray("phone");
if (phoneArray == null) {
softly.assertThat(customer).describedAs("No phone data").isNotInstanceOf(CustomerWithPhone.class);
} else {
String phone = (String) phoneArray.get(rowNum);
if (customer instanceof CustomerWithPhone) {
softly.assertThat(phone).describedAs("Phone").isEqualTo(((CustomerWithPhone) customer).phone);
} else {
softly.assertThat(phone).describedAs("Phone (missing)").isEqualTo(MISSING_VALUE);
}
}
softly.assertAll();
}
use of org.assertj.core.api.SoftAssertions in project metrics by dropwizard.
the class GraphiteSanitizeTest method sanitizeGraphiteValues.
@Test
public void sanitizeGraphiteValues() {
SoftAssertions softly = new SoftAssertions();
softly.assertThat(GraphiteSanitize.sanitize("Foo Bar")).isEqualTo("Foo-Bar");
softly.assertThat(GraphiteSanitize.sanitize(" Foo Bar ")).isEqualTo("Foo-Bar");
softly.assertThat(GraphiteSanitize.sanitize(" Foo Bar")).isEqualTo("Foo-Bar");
softly.assertThat(GraphiteSanitize.sanitize("Foo Bar ")).isEqualTo("Foo-Bar");
softly.assertThat(GraphiteSanitize.sanitize(" Foo Bar ")).isEqualTo("Foo-Bar");
softly.assertThat(GraphiteSanitize.sanitize("Foo@Bar")).isEqualTo("Foo@Bar");
softly.assertThat(GraphiteSanitize.sanitize("Foó Bar")).isEqualTo("Foó-Bar");
softly.assertThat(GraphiteSanitize.sanitize("||ó/.")).isEqualTo("||ó/.");
softly.assertThat(GraphiteSanitize.sanitize("${Foo:Bar:baz}")).isEqualTo("${Foo:Bar:baz}");
softly.assertThat(GraphiteSanitize.sanitize("St. Foo's of Bar")).isEqualTo("St.-Foo's-of-Bar");
softly.assertThat(GraphiteSanitize.sanitize("(Foo and (Bar and (Baz)))")).isEqualTo("(Foo-and-(Bar-and-(Baz)))");
softly.assertThat(GraphiteSanitize.sanitize("Foo.bar.baz")).isEqualTo("Foo.bar.baz");
softly.assertThat(GraphiteSanitize.sanitize("FooBar")).isEqualTo("FooBar");
softly.assertAll();
}
use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.
the class IterableOfEntryToMapConverterUnitTests method testConversions.
@Test
public void testConversions() {
Map<Object, Object> map = new HashMap<>();
map.put("key", "value");
List<Object[]> testValues = asList(//
new Object[] { emptySet(), emptyMap() }, //
new Object[] { emptyList(), emptyMap() }, //
new Object[] { "string", false }, //
new Object[] { asList(new SimpleEntry<>("key", "value")), map }, //
new Object[] { asList("string"), IllegalArgumentException.class });
SoftAssertions softly = new SoftAssertions();
testValues.forEach(array -> softly.assertThat(tryToConvert(array[0])).isEqualTo(array[1]));
softly.assertAll();
}
use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.
the class JdbcEntityTemplateIntegrationTests method saveAndDeleteAnEntityWithReferencedEntity.
// DATAJDBC-112
@Test
public void saveAndDeleteAnEntityWithReferencedEntity() {
template.save(legoSet, LegoSet.class);
template.delete(legoSet, LegoSet.class);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(template.findAll(LegoSet.class)).isEmpty();
softly.assertThat(template.findAll(Manual.class)).isEmpty();
softly.assertAll();
}
use of org.assertj.core.api.SoftAssertions in project spring-data-jdbc by spring-projects.
the class JdbcEntityTemplateIntegrationTests method updateReferencedEntityToNull.
// DATAJDBC-112
@Test
public void updateReferencedEntityToNull() {
template.save(legoSet, LegoSet.class);
legoSet.setManual(null);
template.save(legoSet, LegoSet.class);
LegoSet reloadedLegoSet = template.findById(legoSet.getId(), LegoSet.class);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(reloadedLegoSet.manual).isNull();
softly.assertThat(template.findAll(Manual.class)).describedAs("Manuals failed to delete").isEmpty();
softly.assertAll();
}
Aggregations