Search in sources :

Example 1 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project wh-app-android by WhiteHouse.

the class DataTest method listOfFeedItemEqualsFeedItem.

@Test
public void listOfFeedItemEqualsFeedItem() {
    SoftAssertions softly = new SoftAssertions();
    FeedItem item = generateFeedItem();
    FeedItem dupe = generateFeedItem();
    List<FeedItem> list1 = new ArrayList<>(1);
    List<FeedItem> list2 = new ArrayList<>(1);
    list1.add(item);
    list2.add(item);
    softly.assertThat(list1).hasSameElementsAs(list2);
    softly.assertThat(list1).isEqualTo(list2);
    list2.clear();
    list2.add(dupe);
    softly.assertThat(list1).hasSameElementsAs(list2);
    softly.assertThat(list1).isEqualTo(list2);
    softly.assertAll();
}
Also used : FeedItem(gov.whitehouse.data.model.FeedItem) SoftAssertions(org.assertj.core.api.SoftAssertions) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with SoftAssertions

use of org.assertj.core.api.SoftAssertions in project geode by apache.

the class DataCommandFunctionWithPDXJUnitTest method testTableIsRectangular.

// GEODE-2662: building a table where early values are missing keys causes the data to shift
// upward during reporting.
@Test
public void testTableIsRectangular() throws GfJsonException {
    TabularResultData rawTable = getTableFromQuery("select * from /" + PARTITIONED_REGION);
    // Verify any table built
    assertThat(rawTable.getGfJsonObject()).isNotNull();
    assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
    GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
    // Verify table is rectangular
    SoftAssertions softly = new SoftAssertions();
    for (String k : new String[] { "id", "phone", "firstName", "lastName" }) {
        softly.assertThat(tableJson.getJSONArray(k).size()).isEqualTo(4);
    }
    softly.assertAll();
}
Also used : TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) GfJsonObject(org.apache.geode.management.internal.cli.json.GfJsonObject) SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 3 with SoftAssertions

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

the class JdbcEntityTemplateIntegrationTests method saveAndLoadAnEntityWithReferencedEntityById.

// DATAJDBC-112
@Test
public void saveAndLoadAnEntityWithReferencedEntityById() {
    template.save(legoSet, LegoSet.class);
    assertThat(legoSet.manual.id).describedAs("id of stored manual").isNotNull();
    LegoSet reloadedLegoSet = template.findById(legoSet.getId(), LegoSet.class);
    assertThat(reloadedLegoSet.manual).isNotNull();
    SoftAssertions softly = new SoftAssertions();
    // 
    softly.assertThat(reloadedLegoSet.manual.getId()).isEqualTo(// 
    legoSet.getManual().getId()).isNotNull();
    softly.assertThat(reloadedLegoSet.manual.getContent()).isEqualTo(legoSet.getManual().getContent());
    softly.assertAll();
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 4 with SoftAssertions

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

the class JdbcEntityTemplateIntegrationTests method saveAndDeleteAllWithReferencedEntity.

// DATAJDBC-112
@Test
public void saveAndDeleteAllWithReferencedEntity() {
    template.save(legoSet, LegoSet.class);
    template.deleteAll(LegoSet.class);
    SoftAssertions softly = new SoftAssertions();
    assertThat(template.findAll(LegoSet.class)).isEmpty();
    assertThat(template.findAll(Manual.class)).isEmpty();
    softly.assertAll();
}
Also used : SoftAssertions(org.assertj.core.api.SoftAssertions) Test(org.junit.Test)

Example 5 with SoftAssertions

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

the class SqlGeneratorFixedNamingStrategyUnitTests method findOneWithOverriddenFixedTableName.

// DATAJDBC-107
@Test
public void findOneWithOverriddenFixedTableName() {
    SqlGenerator sqlGenerator = configureSqlGenerator(fixedCustomTablePrefixStrategy);
    String sql = sqlGenerator.getFindOne();
    SoftAssertions softAssertions = new SoftAssertions();
    // 
    softAssertions.assertThat(sql).startsWith(// 
    "SELECT").contains(// 
    "FixedCustomSchema.FixedCustomTablePrefix_DummyEntity.FixedCustomPropertyPrefix_id AS FixedCustomPropertyPrefix_id,").contains(// 
    "FixedCustomSchema.FixedCustomTablePrefix_DummyEntity.FixedCustomPropertyPrefix_name AS FixedCustomPropertyPrefix_name,").contains(// 
    "ref.FixedCustomPropertyPrefix_l1id AS ref_FixedCustomPropertyPrefix_l1id").contains(// 
    "ref.FixedCustomPropertyPrefix_content AS ref_FixedCustomPropertyPrefix_content").contains("FROM FixedCustomSchema.FixedCustomTablePrefix_DummyEntity");
    softAssertions.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