From 596078c0bf5604553eddd4b7d5e6cadfd962d024 Mon Sep 17 00:00:00 2001 From: Roberto Franchini Date: Mon, 18 Nov 2024 23:04:44 +0100 Subject: [PATCH] migrate to assertj, disable dome modules --- .../arcadeanalytics/provider/TypeMapper.kt | 56 +- .../provider/TypeMapperKtTest.kt | 68 +- .../com/arcadeanalytics/data/SpriteShould.kt | 147 +- .../neo4j3/Neo4jDataProviderIntTest.kt | 54 +- pom.xml | 58 +- rdbms/pom.xml | 2 - .../persistence/util/DBSourceConnection.java | 5 +- .../MysqlSQLDataProviderTest.java | 2103 ++++--- ...sqlSQLDataProviderWithAggregationTest.java | 857 ++- .../PostgreSQLDataProviderTest.java | 2084 ++++--- ...greSQLDataProviderWithAggregationTest.java | 864 ++- .../rdbms/filter/FilterTableMappingTest.java | 5298 ++++++++--------- .../AbstractRDBMSGraphProvider.java | 4 +- .../graphprovider/MysqlGraphProviderTest.java | 14 +- .../PostgreSQLGraphProviderTest.java | 37 +- .../rdbms/hibernate/HibernateMapperTest.java | 2486 ++++---- .../AggregationStrategyTest.java | 468 +- .../rdbms/mapper/GraphModelBuildingTest.java | 1407 +++-- .../mapper/SourceSchemaBuildingTest.java | 782 ++- .../rdbms/resolver/JavaNameResolverTest.java | 194 +- .../resolver/OriginalNameResolverTest.java | 74 +- .../rdbms/util/FunctionsHandlerTest.java | 25 +- .../rdbms/PostgreSQLMetadataProviderTest.kt | 580 +- 23 files changed, 8878 insertions(+), 8789 deletions(-) diff --git a/common/src/main/kotlin/com/arcadeanalytics/provider/TypeMapper.kt b/common/src/main/kotlin/com/arcadeanalytics/provider/TypeMapper.kt index 0103a63e..8dacca13 100644 --- a/common/src/main/kotlin/com/arcadeanalytics/provider/TypeMapper.kt +++ b/common/src/main/kotlin/com/arcadeanalytics/provider/TypeMapper.kt @@ -25,34 +25,36 @@ import java.util.Locale.ENGLISH val log: Logger = LoggerFactory.getLogger("com.arcadeanalytics.provider.TypeMapper") -fun mapType(type: String): String = when ( - type.trim() - .toLowerCase(ENGLISH) - .removePrefix("http://www.w3.org/2001/xmlschema#") -) { - "string", "varchar", "text", "char", - "varchar2", "nvarchar2", "clob", "nclob", - "char varying", "character varying", "ntext", "nchar", - "national char", "national character", "nvarchar", "national char varying", - "national character varying", "longvarchar", "character large object", - "mediumtext", "longtext", "tinytext", - -> "String" +fun mapType(type: String): String = + when ( + type + .trim() + .lowercase(ENGLISH) + .removePrefix("http://www.w3.org/2001/xmlschema#") + ) { + "string", "varchar", "text", "char", + "varchar2", "nvarchar2", "clob", "nclob", + "char varying", "character varying", "ntext", "nchar", + "national char", "national character", "nvarchar", "national char varying", + "national character varying", "longvarchar", "character large object", + "mediumtext", "longtext", "tinytext", + -> "String" - "decimal", "dec", "numeric", "real", "integer", - "int", "int2", "int4", "tinyint", - "smallint unsigned", "tinyint unsigned", "mediumint unsigned", - "float", "double precision", - "long", "smallint", "money", "smallmoney", "double", - -> "Numeric" + "decimal", "dec", "numeric", "real", "integer", + "int", "int2", "int4", "tinyint", + "smallint unsigned", "tinyint unsigned", "mediumint unsigned", + "float", "double precision", + "long", "smallint", "money", "smallmoney", "double", + -> "Numeric" - "date", "datetime", "datetime2", "timestamp", "year", - "smalldatetime", "datetimeoffset", "time with time zone", - -> "Date" + "date", "datetime", "datetime2", "timestamp", "year", + "smalldatetime", "datetimeoffset", "time with time zone", + -> "Date" - "bool", "boolean", - -> "Boolean" - else -> { - if (log.isDebugEnabled) log.debug("type not mapped:: {} ", type) - type + "bool", "boolean", + -> "Boolean" + else -> { + if (log.isDebugEnabled) log.debug("type not mapped:: {} ", type) + type + } } -} diff --git a/common/src/test/kotlin/com/arcadeanalytics/provider/TypeMapperKtTest.kt b/common/src/test/kotlin/com/arcadeanalytics/provider/TypeMapperKtTest.kt index d0c26198..8d33a46e 100644 --- a/common/src/test/kotlin/com/arcadeanalytics/provider/TypeMapperKtTest.kt +++ b/common/src/test/kotlin/com/arcadeanalytics/provider/TypeMapperKtTest.kt @@ -20,18 +20,30 @@ package com.arcadeanalytics.provider import org.assertj.core.api.Assertions -import org.junit.Test +import org.junit.jupiter.api.Test class TypeMapperKtTest { - @Test fun shouldMapNumericTypes() { listOf( - "decimal", "dec", "numeric", "real", "integer", - "int", "int2", "int4", "tinyint", - "smallint unsigned", "tinyint unsigned", "mediumint unsigned", - "float", "double precision", - "smallint", "money", "double", "smallmoney", + "decimal", + "dec", + "numeric", + "real", + "integer", + "int", + "int2", + "int4", + "tinyint", + "smallint unsigned", + "tinyint unsigned", + "mediumint unsigned", + "float", + "double precision", + "smallint", + "money", + "double", + "smallmoney", ).forEach { Assertions.assertThat(mapType(it)).isEqualTo("Numeric") } @@ -40,16 +52,31 @@ class TypeMapperKtTest { @Test fun shouldMapTextTypes() { listOf( - "string", "varchar", "text", "char", - "varchar2", "nvarchar2", "clob", "nclob", - "char varying", "character varying", "ntext", "nchar", - "national char", "national character", "nvarchar", "national char varying", - "national character varying", "longvarchar", "character large object", - "mediumtext", "longtext", "tinytext", - ) - .forEach { - Assertions.assertThat(mapType(it)).isEqualTo("String") - } + "string", + "varchar", + "text", + "char", + "varchar2", + "nvarchar2", + "clob", + "nclob", + "char varying", + "character varying", + "ntext", + "nchar", + "national char", + "national character", + "nvarchar", + "national char varying", + "national character varying", + "longvarchar", + "character large object", + "mediumtext", + "longtext", + "tinytext", + ).forEach { + Assertions.assertThat(mapType(it)).isEqualTo("String") + } } @Test @@ -63,10 +90,9 @@ class TypeMapperKtTest { "smalldatetime", "datetimeoffset", "time with time zone", - ) - .forEach { - Assertions.assertThat(mapType(it)).isEqualTo("Date") - } + ).forEach { + Assertions.assertThat(mapType(it)).isEqualTo("Date") + } } @Test diff --git a/data/src/test/kotlin/com/arcadeanalytics/data/SpriteShould.kt b/data/src/test/kotlin/com/arcadeanalytics/data/SpriteShould.kt index 5d972746..08956843 100644 --- a/data/src/test/kotlin/com/arcadeanalytics/data/SpriteShould.kt +++ b/data/src/test/kotlin/com/arcadeanalytics/data/SpriteShould.kt @@ -30,7 +30,6 @@ import java.time.format.DateTimeFormatter import java.util.regex.Pattern class SpriteShould { - private lateinit var sprite: Sprite @BeforeEach @@ -40,7 +39,8 @@ class SpriteShould { @Test internal fun `add values of different types`() { - sprite.add("field1", "value1") + sprite + .add("field1", "value1") .add("field2", 10) .add("field3", false) @@ -55,11 +55,13 @@ class SpriteShould { internal fun `flat collection value`() { val values = mutableListOf("value1", "value2", "value3") - sprite.add("field1", values) + sprite + .add("field1", values) .add("field2", 10) .add("field3", false) - assertThat(sprite.rawValuesOf("field1")).isNotEmpty + assertThat(sprite.rawValuesOf("field1")) + .isNotEmpty .hasSize(3) assertThat(sprite.entries()).contains( @@ -73,7 +75,8 @@ class SpriteShould { @Test internal fun `return single value as string`() { - sprite.add("field1", "value1") + sprite + .add("field1", "value1") .add("field2", 10) .add("field3", false) @@ -84,7 +87,8 @@ class SpriteShould { @Test internal fun `return multi value as string`() { - sprite.add("field1", 10) + sprite + .add("field1", 10) .add("field1", 20) .add("field1", 30) @@ -93,7 +97,8 @@ class SpriteShould { @Test internal fun `return multi value as int type`() { - sprite.add("field1", 10) + sprite + .add("field1", 10) .add("field1", 20) .add("field1", 30) @@ -102,7 +107,8 @@ class SpriteShould { @Test internal fun `return single value typed`() { - sprite.add("field1", "value1") + sprite + .add("field1", "value1") .add("field2", 10) .add("field3", false) @@ -113,19 +119,20 @@ class SpriteShould { @Test internal fun `copy single value field`() { - sprite.add("field", "value") + sprite + .add("field", "value") .copy("field", "copyOfField") assertThat(sprite.entries()).contains( entry("field", "value"), entry("copyOfField", "value"), - ) } @Test internal fun `copy multi values field`() { - sprite.add("field", "value1") + sprite + .add("field", "value1") .add("field", "value2") .add("field", "value3") .add("field", "value4") @@ -158,7 +165,8 @@ class SpriteShould { @Test internal fun `rename field`() { - sprite.add("field", "value1") + sprite + .add("field", "value1") .add("field", "value2") .add("field", "value3") .add("field", "value4") @@ -174,7 +182,8 @@ class SpriteShould { @Test internal fun `rename with lambda`() { - sprite.add("a_field", "value1") + sprite + .add("a_field", "value1") .rename(Pattern.compile("a_.*")) { v: String -> v.removePrefix("a_") } assertThat(sprite.data) @@ -184,7 +193,8 @@ class SpriteShould { @Test internal fun `join field values`() { - sprite.add("field", "value1") + sprite + .add("field", "value1") .add("field", "value2") .add("field", "value3") .add("field", "value4") @@ -205,7 +215,8 @@ class SpriteShould { @Test internal fun `split field value`() { - sprite.add("field", "value1 value2 value3 value4") + sprite + .add("field", "value1 value2 value3 value4") .splitValues("field", " ") assertThat(sprite.isMultiValue("field")).isTrue() @@ -222,7 +233,8 @@ class SpriteShould { @Test internal fun `retrieve field names`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field2", "value2") .add("field3", "value3") @@ -232,7 +244,8 @@ class SpriteShould { @Test internal fun `retrieve field names with regexp`() { - sprite.add("field1", "value") + sprite + .add("field1", "value") .add("field2", "value2") .add("field3", "value3") .add("a_field", "value") @@ -249,7 +262,8 @@ class SpriteShould { @Test internal fun `retrieve field string values with regexp`() { - sprite.add("field1", "value") + sprite + .add("field1", "value") .add("field2", "value2") .add("field3", "value3") .add("a_field", "value") @@ -286,7 +300,8 @@ class SpriteShould { @Test internal fun `remove fields`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field", "value2") .add("field2", "value2") @@ -297,7 +312,8 @@ class SpriteShould { @Test internal fun `remove fields with pattern`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field", "value2") .add("field2", "value2") @@ -309,11 +325,12 @@ class SpriteShould { @Test internal fun `load from map`() { val now = LocalDate.now() - val input = mapOf( - "field1" to "value1", - "field2" to "value2", - "field3" to now, - ) + val input = + mapOf( + "field1" to "value1", + "field2" to "value2", + "field3" to now, + ) sprite.load(input) @@ -326,10 +343,11 @@ class SpriteShould { @Test internal fun `apply lambda to all field values`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field", "value2") - sprite.apply("field", String::toUpperCase) + sprite.apply("field", String::uppercase) assertThat(sprite.data).isNotEmpty() @@ -338,10 +356,11 @@ class SpriteShould { @Test internal fun `apply lambda to all fields matching a pattern`() { - sprite.add("firstField", "value") + sprite + .add("firstField", "value") .add("secondField", "value2") - sprite.apply(Pattern.compile(".*Field"), String::toUpperCase) + sprite.apply(Pattern.compile(".*Field"), String::uppercase) assertThat(sprite.data).isNotEmpty() @@ -351,10 +370,11 @@ class SpriteShould { @Test internal fun `apply lambda to all field values and store on another field`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field", "value2") - sprite.apply("field", String::toUpperCase, "to") + sprite.apply("field", String::uppercase, "to") assertThat(sprite.data).isNotEmpty() @@ -365,11 +385,13 @@ class SpriteShould { @Test internal fun `return map with single value`() { val now = LocalDate.now() - val map = sprite.add("field", "value") - .add("field", "value2") - .add("field", "value3") - .add("dateField", now) - .asMap() + val map = + sprite + .add("field", "value") + .add("field", "value2") + .add("field", "value3") + .add("dateField", now) + .asMap() assertThat(map?.get("field")).isEqualTo("value") assertThat(map?.get("dateField")).isEqualTo(now) @@ -378,11 +400,13 @@ class SpriteShould { @Test internal fun `return map with single value as string`() { val now = LocalDate.now() - val map = sprite.add("field", "value") - .add("field", "value2") - .add("field", "value3") - .add("dateField", now) - .asStringMap() + val map = + sprite + .add("field", "value") + .add("field", "value2") + .add("field", "value3") + .add("dateField", now) + .asStringMap() assertThat(map.get("field")).isEqualTo("value") @@ -391,11 +415,13 @@ class SpriteShould { @Test internal fun `transform sprite to mutable map of collections`() { - val map = sprite.add("field", "value") - .add("field", "value2") - .add("field", "value3") - .add("single", "singleValue") - .asMultimap() + val map = + sprite + .add("field", "value") + .add("field", "value2") + .add("field", "value3") + .add("single", "singleValue") + .asMultimap() assertThat(map?.get("field")) .hasSize(3) @@ -408,7 +434,8 @@ class SpriteShould { @Test internal fun `answer about field's size`() { - sprite.add("field", "value") + sprite + .add("field", "value") .add("field", "value2") .add("field", "value3") .add("dateField", LocalDate.now()) @@ -435,7 +462,8 @@ class SpriteShould { @Test internal fun `view date as string`() { - sprite.add("text", "the text") + sprite + .add("text", "the text") .add("text", "another text") .add("date", LocalDate.parse("20180901", DateTimeFormatter.ofPattern("yyyyMMdd"))) .add("age", 10) @@ -446,17 +474,18 @@ class SpriteShould { @Test internal fun `show an ETL example`() { - val data = Sprite() - .add("age", 90) - .add("name", "rob") - .add("text", "first phrase") - .add("text", "second phrase") - .add("text", "third phrase") - .add("text", "fourth phrase") - .rename("age", "weight") - .apply("weight") { v: Float -> v * 2.2 } - .apply("name", String::toUpperCase) - .joinValuesOf("text") + val data = + Sprite() + .add("age", 90) + .add("name", "rob") + .add("text", "first phrase") + .add("text", "second phrase") + .add("text", "third phrase") + .add("text", "fourth phrase") + .rename("age", "weight") + .apply("weight") { v: Int -> v * 2.2 } + .apply("name", String::uppercase) + .joinValuesOf("text") assertThat(data.hasField("age")) .isFalse() diff --git a/neo4j3/src/test/kotlin/com/arcadeanalytics/provider/neo4j3/Neo4jDataProviderIntTest.kt b/neo4j3/src/test/kotlin/com/arcadeanalytics/provider/neo4j3/Neo4jDataProviderIntTest.kt index da74a5ae..d739df4b 100644 --- a/neo4j3/src/test/kotlin/com/arcadeanalytics/provider/neo4j3/Neo4jDataProviderIntTest.kt +++ b/neo4j3/src/test/kotlin/com/arcadeanalytics/provider/neo4j3/Neo4jDataProviderIntTest.kt @@ -32,7 +32,6 @@ import org.neo4j.driver.v1.AccessMode @TestInstance(TestInstance.Lifecycle.PER_CLASS) class Neo4jDataProviderIntTest { - private val provider: Neo4jDataProvider = Neo4jDataProvider() @Test @@ -58,7 +57,7 @@ class Neo4jDataProviderIntTest { @Test @Throws(Exception::class) - fun testFetchData() { + fun fetchData() { // given // when @@ -72,12 +71,14 @@ class Neo4jDataProviderIntTest { assertThat(data.edgesClasses).containsKeys("FriendOf") val cytoData = data.nodes.first() - assertThat(cytoData.data.record).isNotNull + assertThat(cytoData.data.record) + .isNotNull .containsKeys("name", "@edgeCount", "@in", "@out") println("cytoData = $cytoData") val record = cytoData.data.record - assertThat(record).isNotNull + assertThat(record) + .isNotNull .containsKeys("name", "@edgeCount", "@in", "@out") assertThat(record["@edgeCount"]).isEqualTo(2) @@ -87,7 +88,7 @@ class Neo4jDataProviderIntTest { @Test @Throws(Exception::class) - fun testFetchNodes() { + fun fetchNodes() { // given // when @@ -131,12 +132,17 @@ class Neo4jDataProviderIntTest { val cytoData = data.nodes.first() assertThat(cytoData.data.record).isNotNull - assertThat(cytoData.data.record["@edgeCount"].toString().toInt()).isGreaterThan(0) + assertThat( + cytoData.data.record["@edgeCount"] + .toString() + .toInt(), + ).isGreaterThan(0) assertThat(cytoData.data.source).isEmpty() val record = cytoData.data.record - assertThat(record).isNotNull + assertThat(record) + .isNotNull .containsKeys("name", "@edgeCount", "@in", "@out") assertThat(record["@edgeCount"]).isEqualTo(2) @@ -152,12 +158,17 @@ class Neo4jDataProviderIntTest { val cytoData = data.nodes.first() assertThat(cytoData.data.record).isNotNull - assertThat(cytoData.data.record["@edgeCount"].toString().toInt()).isGreaterThan(0) + assertThat( + cytoData.data.record["@edgeCount"] + .toString() + .toInt(), + ).isGreaterThan(0) assertThat(cytoData.data.source).isEmpty() val record = cytoData.data.record - assertThat(record).isNotNull + assertThat(record) + .isNotNull .containsKeys("name", "@edgeCount", "@in", "@out") assertThat(record["@edgeCount"]).isEqualTo(2) @@ -176,10 +187,12 @@ class Neo4jDataProviderIntTest { val firstNode = firstDataSet.nodes.first().data val secondNode = secondDataSet.nodes.first().data - val edgeClasses = (firstNode.record["@in"] as Map).keys - .union((firstNode.record["@out"] as Map).keys) - .union((secondNode.record["@in"] as Map).keys) - .union((secondNode.record["@out"] as Map).keys) + val edgeClasses = + (firstNode.record["@in"] as Map) + .keys + .union((firstNode.record["@out"] as Map).keys) + .union((secondNode.record["@in"] as Map).keys) + .union((secondNode.record["@out"] as Map).keys) val data = provider.edges(dataSource, arrayOf(firstNode.id), edgeClasses.toTypedArray(), arrayOf(secondNode.id)) @@ -201,12 +214,17 @@ class Neo4jDataProviderIntTest { val cytoData = data.nodes.first() println("cytoData = $cytoData") assertThat(cytoData.data.record).isNotNull - assertThat(cytoData.data.record["@edgeCount"].toString().toInt()).isGreaterThan(0) + assertThat( + cytoData.data.record["@edgeCount"] + .toString() + .toInt(), + ).isGreaterThan(0) assertThat(cytoData.data.source).isEmpty() val record = cytoData.data.record - assertThat(record).isNotNull + assertThat(record) + .isNotNull .containsKeys("name", "@edgeCount", "@in", "@out") assertThat(record["@edgeCount"]).isEqualTo(2) @@ -229,7 +247,11 @@ class Neo4jDataProviderIntTest { assertThat(data.nodesClasses).containsKeys("Person") assertThat(data.edgesClasses).containsKeys("FriendOf") - val cytoData = data.nodes.stream().findFirst().get() + val cytoData = + data.nodes + .stream() + .findFirst() + .get() assertThat(cytoData.data.record).isNotNull assertThat(cytoData.data.record["@edgeCount"]).isEqualTo(2) diff --git a/pom.xml b/pom.xml index 009f8841..a6051fa2 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 3.2.7 3.2.4 3.1.0 - 3.0.0-M5 + 3.1.2 3.2.0 3.8.1 0.8.6 @@ -59,8 +59,7 @@ 3.19.0 3.4.0 1.20.2 - - + 2.18.1 @@ -88,13 +87,13 @@ data common - gremlin + neo4j3 - orientdb2 - orientdb3 + + rdbms - integration - test-coverage-aggregator + + @@ -206,16 +205,16 @@ - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - - prepare-agent - - + + + + + + + + + + @@ -224,8 +223,8 @@ - - + + org.sonatype.plugins @@ -442,6 +441,19 @@ + + + + + com.fasterxml.jackson + jackson-bom + ${jackson.version} + import + pom + + + + @@ -497,6 +509,12 @@ kotlin-test-junit ${kotlin.version} test + + + junit + junit + + org.assertj diff --git a/rdbms/pom.xml b/rdbms/pom.xml index 82c04233..f8c60d74 100644 --- a/rdbms/pom.xml +++ b/rdbms/pom.xml @@ -24,7 +24,6 @@ 42.3.8 2.7.1 0.4.4 - 2.16.1 4.0 @@ -124,7 +123,6 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-databind.version} compile diff --git a/rdbms/src/main/java/com/arcadeanalytics/provider/rdbms/persistence/util/DBSourceConnection.java b/rdbms/src/main/java/com/arcadeanalytics/provider/rdbms/persistence/util/DBSourceConnection.java index a50d1389..06cf98e6 100644 --- a/rdbms/src/main/java/com/arcadeanalytics/provider/rdbms/persistence/util/DBSourceConnection.java +++ b/rdbms/src/main/java/com/arcadeanalytics/provider/rdbms/persistence/util/DBSourceConnection.java @@ -74,14 +74,13 @@ public static Connection getConnection(DataSourceInfo datasource) { .readValue(Optional.ofNullable(datasource.getConnectionProperties()) .orElse("{}"), HashMap.class); - if (connectionAdditionalProperties.size() > 0) { + if (!connectionAdditionalProperties.isEmpty()) { for (String connectionProp : connectionAdditionalProperties.keySet()) { props.setProperty(connectionProp, connectionAdditionalProperties.get(connectionProp)); } } - Connection connection = DriverManager.getConnection(uri, props); - return connection; + return DriverManager.getConnection(uri, props); } catch (Exception e) { throw new RDBMSProviderRuntimeException(e); } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderTest.java index 53d3a095..28d483ad 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderTest.java @@ -20,10 +20,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.CytoData; import com.arcadeanalytics.provider.DataSourceInfo; @@ -43,7 +41,7 @@ import org.junit.jupiter.api.Test; import org.testcontainers.containers.MySQLContainer; -public class MysqlSQLDataProviderTest extends AbstractRDBMSProviderTest { +class MysqlSQLDataProviderTest extends AbstractRDBMSProviderTest { private static final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssX"); @@ -83,93 +81,93 @@ public void fetchDataThroughTableScanTest() throws Exception { GraphData data = provider.fetchData(dataSource, query, 5); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); CytoData currNodeContent; Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(1, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("PENELOPE", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("GUINESS", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("PENELOPE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("GUINESS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals("2006-02-15 05:34:33.0", currRecord.get("last_update").toString()); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 2); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "NICK"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "WAHLBERG"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("NICK"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("WAHLBERG"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals("2006-02-15 05:34:33.0", currRecord.get("last_update").toString()); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(3, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("ED", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("CHASE", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("ED"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("CHASE"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals("2006-02-15 05:34:33.0", currRecord.get("last_update").toString()); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(4, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("JENNIFER", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("DAVIS", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JENNIFER"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("DAVIS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals("2006-02-15 05:34:33.0", currRecord.get("last_update").toString()); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(5, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("JOHNNY", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("LOLLOBRIGIDA", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JOHNNY"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("LOLLOBRIGIDA"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals("2006-02-15 05:34:33.0", currRecord.get("last_update").toString()); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); } @Override @@ -186,25 +184,25 @@ public void loadVerticesFromIdsMultipleTablesTest() { GraphData data = provider.load(dataSource, ids); - assertEquals(data.getNodesClasses().size(), 2); - assertEquals(data.getNodes().size(), 7); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(2); + assertThat(data.getNodes().size()).isEqualTo(7); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); - assertTrue(data.getNodesClasses().containsKey("store")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); + assertThat(data.getNodesClasses().containsKey("store")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); Map storeClass = data.getNodesClasses().get("store"); - assertTrue(storeClass.containsKey("store_id")); - assertTrue(storeClass.containsKey("manager_staff_id")); - assertTrue(storeClass.containsKey("address_id")); - assertTrue(storeClass.containsKey("last_update")); + assertThat(storeClass.containsKey("store_id")).isTrue(); + assertThat(storeClass.containsKey("manager_staff_id")).isTrue(); + assertThat(storeClass.containsKey("address_id")).isTrue(); + assertThat(storeClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -213,98 +211,98 @@ public void loadVerticesFromIdsMultipleTablesTest() { try { currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(1, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("PENELOPE", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("GUINESS", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("PENELOPE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("GUINESS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(2, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("NICK", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("WAHLBERG", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("NICK"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("WAHLBERG"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(3, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("ED", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("CHASE", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("ED"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("CHASE"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(4, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("JENNIFER", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("DAVIS", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JENNIFER"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("DAVIS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(5, currRecord.get("actor_id")); - assertTrue(currRecord.containsKey("first_name")); - assertEquals("JOHNNY", currRecord.get("first_name")); - assertTrue(currRecord.containsKey("last_name")); - assertEquals("LOLLOBRIGIDA", currRecord.get("last_name")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JOHNNY"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("LOLLOBRIGIDA"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(1, currRecord.get("store_id")); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(1, currRecord.get("manager_staff_id")); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(1, currRecord.get("address_id")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:57:12-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(1); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:57:12-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(2, currRecord.get("store_id")); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(2, currRecord.get("manager_staff_id")); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(2, currRecord.get("address_id")); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:57:12-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(2); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(2); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(2); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:57:12-00").toInstant()); } catch (ParseException e) { e.printStackTrace(); - fail(); + fail(""); } } @@ -322,19 +320,19 @@ public void loadVerticesFromIdsSingleTableTest() throws Exception { GraphData data = provider.load(dataSource, actorIds); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -342,70 +340,70 @@ public void loadVerticesFromIdsSingleTableTest() throws Exception { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "PENELOPE"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "GUINESS"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("PENELOPE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("GUINESS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 2); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "NICK"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "WAHLBERG"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("NICK"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("WAHLBERG"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 3); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "ED"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "CHASE"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("ED"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("CHASE"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 4); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "JENNIFER"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "DAVIS"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JENNIFER"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("DAVIS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 5); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "JOHNNY"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "LOLLOBRIGIDA"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(df.parse("2006-02-15 04:34:33-00").toInstant(), ((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("JOHNNY"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("LOLLOBRIGIDA"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(((Date) currRecord.get("last_update")).toInstant()).isEqualTo(df.parse("2006-02-15 04:34:33-00").toInstant()); /* * Fetching 2 vertices from the store table by cyto-ids @@ -417,48 +415,48 @@ public void loadVerticesFromIdsSingleTableTest() throws Exception { String[] storeIds = { "16_1", "16_2" }; data = provider.load(dataSource, storeIds); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 2); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(2); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("store")); + assertThat(data.getNodesClasses().containsKey("store")).isTrue(); Map storeClass = data.getNodesClasses().get("store"); - assertTrue(storeClass.containsKey("store_id")); - assertTrue(storeClass.containsKey("manager_staff_id")); - assertTrue(storeClass.containsKey("address_id")); - assertTrue(storeClass.containsKey("last_update")); + assertThat(storeClass.containsKey("store_id")).isTrue(); + assertThat(storeClass.containsKey("manager_staff_id")).isTrue(); + assertThat(storeClass.containsKey("address_id")).isTrue(); + assertThat(storeClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 1); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 1); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:57:12-00").toInstant()); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(1); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:57:12-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 2); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 2); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 2); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:57:12-00").toInstant()); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(2); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(2); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(2); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:57:12-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); } @Override @@ -497,31 +495,31 @@ public void expand1To1RelWithSimpleFKTest() throws Exception { st.execute(distributionCountryFilling); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } String[] rootIds = { "7_1", "7_2", "7_3", "7_4", "7_5", "7_6" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_distribution_language", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 6); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 6); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(6); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(6); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("language")); + assertThat(data.getNodesClasses().containsKey("language")).isTrue(); Map languageClass = data.getNodesClasses().get("language"); - assertTrue(languageClass.containsKey("language_id")); - assertTrue(languageClass.containsKey("name")); - assertTrue(languageClass.containsKey("last_update")); + assertThat(languageClass.containsKey("language_id")).isTrue(); + assertThat(languageClass.containsKey("name")).isTrue(); + assertThat(languageClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -529,140 +527,140 @@ public void expand1To1RelWithSimpleFKTest() throws Exception { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 1); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "English"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(1); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("English"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 2); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Italian"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(2); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Italian"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 3); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Japanese"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(3); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Japanese"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 4); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Mandarin"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(4); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Mandarin"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 5); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "French"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(5); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("French"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 6); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "German"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 05:02:19-00").toInstant()); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(6); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("German"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 05:02:19-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_1"); - assertEquals(currEdgeContent.getData().getTarget(), "13_1"); - assertEquals(currEdgeContent.getData().getId(), "71_131"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("71_131"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_2"); - assertEquals(currEdgeContent.getData().getTarget(), "13_2"); - assertEquals(currEdgeContent.getData().getId(), "72_132"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("72_132"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_3"); - assertEquals(currEdgeContent.getData().getTarget(), "13_3"); - assertEquals(currEdgeContent.getData().getId(), "73_133"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_3"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_3"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("73_133"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_4"); - assertEquals(currEdgeContent.getData().getTarget(), "13_4"); - assertEquals(currEdgeContent.getData().getId(), "74_134"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_4"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_4"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("74_134"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_5"); - assertEquals(currEdgeContent.getData().getTarget(), "13_5"); - assertEquals(currEdgeContent.getData().getId(), "75_135"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_5"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_5"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("75_135"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_6"); - assertEquals(currEdgeContent.getData().getTarget(), "13_6"); - assertEquals(currEdgeContent.getData().getId(), "76_136"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_6"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_6"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("76_136"); // 1-1 Relationship: language <-[has_distribution_language]- distribution_country @@ -674,155 +672,155 @@ public void expand1To1RelWithSimpleFKTest() throws Exception { rootIds[5] = "13_6"; data = provider.expand(dataSource, rootIds, "in", "has_distribution_language", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 6); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 6); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(6); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(6); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("distribution_country")); + assertThat(data.getNodesClasses().containsKey("distribution_country")).isTrue(); Map distributionCountryClass = data.getNodesClasses().get("distribution_country"); - assertTrue(distributionCountryClass.containsKey("distribution_country_id")); - assertTrue(distributionCountryClass.containsKey("name")); - assertTrue(distributionCountryClass.containsKey("distribution_language")); + assertThat(distributionCountryClass.containsKey("distribution_country_id")).isTrue(); + assertThat(distributionCountryClass.containsKey("name")).isTrue(); + assertThat(distributionCountryClass.containsKey("distribution_language")).isTrue(); it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 1); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "USA"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 1); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(1); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("USA"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(1); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 2); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Italy"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 2); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(2); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Italy"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(2); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 3); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Japan"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 3); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(3); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Japan"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(3); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 4); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "China"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 4); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(4); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("China"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(4); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 5); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "France"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 5); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(5); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("France"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(5); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 6); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Germany"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 6); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(6); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Germany"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(6); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_1"); - assertEquals(currEdgeContent.getData().getTarget(), "13_1"); - assertEquals(currEdgeContent.getData().getId(), "71_131"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("71_131"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_2"); - assertEquals(currEdgeContent.getData().getTarget(), "13_2"); - assertEquals(currEdgeContent.getData().getId(), "72_132"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("72_132"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_3"); - assertEquals(currEdgeContent.getData().getTarget(), "13_3"); - assertEquals(currEdgeContent.getData().getId(), "73_133"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_3"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_3"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("73_133"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_4"); - assertEquals(currEdgeContent.getData().getTarget(), "13_4"); - assertEquals(currEdgeContent.getData().getId(), "74_134"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_4"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_4"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("74_134"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_5"); - assertEquals(currEdgeContent.getData().getTarget(), "13_5"); - assertEquals(currEdgeContent.getData().getId(), "75_135"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_5"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_5"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("75_135"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_6"); - assertEquals(currEdgeContent.getData().getTarget(), "13_6"); - assertEquals(currEdgeContent.getData().getId(), "76_136"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_6"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("13_6"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("76_136"); // dropping the new added table try { @@ -838,13 +836,13 @@ public void expand1To1RelWithSimpleFKTest() throws Exception { st.execute(deleteDistributionCountryTable); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } @@ -857,18 +855,18 @@ public void expand1ToNRelWithSimpleFKTest() { String[] rootIds = { "4_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_country", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 1); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 1); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(1); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(1); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("country")); + assertThat(data.getNodesClasses().containsKey("country")).isTrue(); Map customerClass = data.getNodesClasses().get("country"); - assertTrue(customerClass.containsKey("country_id")); - assertTrue(customerClass.containsKey("country")); - assertTrue(customerClass.containsKey("last_update")); + assertThat(customerClass.containsKey("country_id")).isTrue(); + assertThat(customerClass.containsKey("country")).isTrue(); + assertThat(customerClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -877,18 +875,18 @@ public void expand1ToNRelWithSimpleFKTest() { try { currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("country")); - assertEquals(currRecord.get("country"), "Spain"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:44:00-00").toInstant()); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("country")).isTrue(); + assertThat(currRecord.get("country")).isEqualTo("Spain"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:44:00-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); } catch (ParseException e) { e.printStackTrace(); - fail(); + fail(""); } // edges checks @@ -896,157 +894,157 @@ public void expand1ToNRelWithSimpleFKTest() { CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); + assertThat(currRecord.size()).isEqualTo(0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_1"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "41_587"); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("41_587"); // 1-N Relationship: city <-[has_country]- country rootIds[0] = "5_87"; data = provider.expand(dataSource, rootIds, "in", "has_country", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 5); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(5); // nodes checks it = data.getNodes().iterator(); try { currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 1); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "A Corua (La Corua)"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:45:25-00").toInstant()); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(1); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("A Corua (La Corua)"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:45:25-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 146); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Donostia-San Sebastin"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:45:25-00").toInstant()); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(146); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Donostia-San Sebastin"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:45:25-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 181); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Gijn"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:45:25-00").toInstant()); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(181); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Gijn"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:45:25-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 388); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Ourense (Orense)"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:45:25-00").toInstant()); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(388); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Ourense (Orense)"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:45:25-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 459); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Santiago de Compostela"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:45:25-00").toInstant()); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(459); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Santiago de Compostela"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:45:25-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); } catch (ParseException e) { e.printStackTrace(); - fail(); + fail(""); } // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_1"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "41_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("41_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_146"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4146_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_146"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4146_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_181"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4181_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_181"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4181_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_388"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4388_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_388"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4388_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_459"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4459_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_459"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4459_587"); } @Override @@ -1057,24 +1055,24 @@ public void expandMultiple1ToNRelWithSimpleFKTest() { String[] rootIds = { "14_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_customer", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 1); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 1); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(1); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(1); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("customer")); + assertThat(data.getNodesClasses().containsKey("customer")).isTrue(); Map customerClass = data.getNodesClasses().get("customer"); - assertTrue(customerClass.containsKey("customer_id")); - assertTrue(customerClass.containsKey("store_id")); - assertTrue(customerClass.containsKey("first_name")); - assertTrue(customerClass.containsKey("last_name")); - assertTrue(customerClass.containsKey("email")); - assertTrue(customerClass.containsKey("address_id")); - assertTrue(customerClass.containsKey("create_date")); - assertTrue(customerClass.containsKey("last_update")); - assertTrue(customerClass.containsKey("active")); + assertThat(customerClass.containsKey("customer_id")).isTrue(); + assertThat(customerClass.containsKey("store_id")).isTrue(); + assertThat(customerClass.containsKey("first_name")).isTrue(); + assertThat(customerClass.containsKey("last_name")).isTrue(); + assertThat(customerClass.containsKey("email")).isTrue(); + assertThat(customerClass.containsKey("address_id")).isTrue(); + assertThat(customerClass.containsKey("create_date")).isTrue(); + assertThat(customerClass.containsKey("last_update")).isTrue(); + assertThat(customerClass.containsKey("active")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -1083,30 +1081,29 @@ public void expandMultiple1ToNRelWithSimpleFKTest() { try { currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("customer_id")); - assertEquals(currRecord.get("customer_id"), 130); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "CHARLOTTE"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "HUNTER"); - assertTrue(currRecord.containsKey("email")); - assertEquals(currRecord.get("email"), "CHARLOTTE.HUNTER@sakilacustomer.org"); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 134); - assertTrue(currRecord.containsKey("create_date")); - assertEquals(((Date) currRecord.get("create_date")).toInstant(), df.parse("2006-02-14 22:04:36-00").toInstant()); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:57:20-00").toInstant()); - assertTrue(currRecord.containsKey("active")); - assertEquals(currRecord.get("active"), true); + assertThat(currRecord.containsKey("customer_id")).isTrue(); + assertThat(currRecord.get("customer_id")).isEqualTo(130); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("CHARLOTTE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("HUNTER"); + assertThat(currRecord.containsKey("email")).isTrue(); + assertThat(currRecord.get("email")).isEqualTo("CHARLOTTE.HUNTER@sakilacustomer.org"); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(134); + assertThat(currRecord.containsKey("create_date")).isTrue(); + assertThat(df.parse("2006-02-14 22:04:36-00").toInstant()).isEqualTo(((Date) currRecord.get("create_date")).toInstant()); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:57:20-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); + assertThat(currRecord.containsKey("active")).isTrue(); + assertThat(currRecord.get("active")).isEqualTo(true); } catch (ParseException e) { - e.printStackTrace(); - fail(); + fail(""); } // edges checks @@ -1114,37 +1111,37 @@ public void expandMultiple1ToNRelWithSimpleFKTest() { CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); + assertThat(currRecord.size()).isEqualTo(0); - assertEquals(currEdgeContent.getClasses(), "has_customer"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "14_1"); - assertEquals(currEdgeContent.getData().getTarget(), "6_130"); - assertEquals(currEdgeContent.getData().getId(), "141_6130"); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_customer"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("14_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("6_130"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("141_6130"); // 1-N Relationship: customer <-[has_customer]- rental rootIds[0] = "6_130"; data = provider.expand(dataSource, rootIds, "in", "has_customer", 300); - assertEquals(data.getNodesClasses().size(), 2); - assertEquals(data.getNodes().size(), 48); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 48); + assertThat(data.getNodesClasses().size()).isEqualTo(2); + assertThat(data.getNodes().size()).isEqualTo(48); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(48); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("rental")); - assertTrue(data.getNodesClasses().containsKey("payment")); // has_customer represents also the relationship: Payment -> Customer + assertThat(data.getNodesClasses().containsKey("rental")).isTrue(); + assertThat(data.getNodesClasses().containsKey("payment")).isTrue(); // has_customer represents also the relationship: Payment -> Customer // nodes checks Set rentalNodes = data.getNodes().stream().filter(rentalNode -> rentalNode.getClasses().equals("rental")).collect(Collectors.toSet()); Set paymentNodes = data.getNodes().stream().filter(rentalNode -> rentalNode.getClasses().equals("payment")).collect(Collectors.toSet()); - assertEquals(rentalNodes.size(), 24); - assertEquals(paymentNodes.size(), 24); + assertThat(rentalNodes.size()).isEqualTo(24); + assertThat(paymentNodes.size()).isEqualTo(24); } @Override @@ -1158,18 +1155,18 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { String[] rootIds = { "1_1" }; GraphData data = provider.expand(dataSource, rootIds, "in", "has_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film_actor")); + assertThat(data.getNodesClasses().containsKey("film_actor")).isTrue(); Map filmActorClass = data.getNodesClasses().get("film_actor"); - assertTrue(filmActorClass.containsKey("film_id")); - assertTrue(filmActorClass.containsKey("actor_id")); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("film_id")).isTrue(); + assertThat(filmActorClass.containsKey("actor_id")).isTrue(); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); String[] joinRecordRoots = new String[19]; int i = 0; @@ -1182,28 +1179,28 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { data = provider.expand(dataSource, joinRecordRoots, "out", "has_film", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film")); + assertThat(data.getNodesClasses().containsKey("film")).isTrue(); Map filmClass = data.getNodesClasses().get("film"); - assertTrue(filmClass.containsKey("film_id")); - assertTrue(filmClass.containsKey("title")); - assertTrue(filmClass.containsKey("description")); - assertTrue(filmClass.containsKey("release_year")); - assertTrue(filmClass.containsKey("language_id")); - assertTrue(filmClass.containsKey("original_language_id")); - assertTrue(filmClass.containsKey("rental_duration")); - assertTrue(filmClass.containsKey("rental_rate")); - assertTrue(filmClass.containsKey("length")); - assertTrue(filmClass.containsKey("replacement_cost")); - assertTrue(filmClass.containsKey("rating")); - assertTrue(filmClass.containsKey("last_update")); - assertTrue(filmClass.containsKey("special_features")); + assertThat(filmClass.containsKey("film_id")).isTrue(); + assertThat(filmClass.containsKey("title")).isTrue(); + assertThat(filmClass.containsKey("description")).isTrue(); + assertThat(filmClass.containsKey("release_year")).isTrue(); + assertThat(filmClass.containsKey("language_id")).isTrue(); + assertThat(filmClass.containsKey("original_language_id")).isTrue(); + assertThat(filmClass.containsKey("rental_duration")).isTrue(); + assertThat(filmClass.containsKey("rental_rate")).isTrue(); + assertThat(filmClass.containsKey("length")).isTrue(); + assertThat(filmClass.containsKey("replacement_cost")).isTrue(); + assertThat(filmClass.containsKey("rating")).isTrue(); + assertThat(filmClass.containsKey("last_update")).isTrue(); + assertThat(filmClass.containsKey("special_features")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -1211,426 +1208,426 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 1); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ACADEMY DINOSAUR"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(1); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ACADEMY DINOSAUR"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 23); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ANACONDA CONFESSIONS"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(23); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ANACONDA CONFESSIONS"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 25); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ANGELS LIFE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(25); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ANGELS LIFE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 106); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "BULWORTH COMMANDMENTS"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(106); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("BULWORTH COMMANDMENTS"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 140); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "CHEAPER CLYDE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(140); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("CHEAPER CLYDE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 166); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "COLOR PHILADELPHIA"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(166); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("COLOR PHILADELPHIA"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 277); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ELEPHANT TROJAN"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(277); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ELEPHANT TROJAN"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 361); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "GLEAMING JAWBREAKER"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(361); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("GLEAMING JAWBREAKER"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 438); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "HUMAN GRAFFITI"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(438); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("HUMAN GRAFFITI"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 499); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "KING EVOLUTION"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(499); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("KING EVOLUTION"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 506); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "LADY STAGE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(506); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("LADY STAGE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 509); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "LANGUAGE COWBOY"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(509); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("LANGUAGE COWBOY"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 605); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "MULHOLLAND BEAST"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(605); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("MULHOLLAND BEAST"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 635); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "OKLAHOMA JUMANJI"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(635); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("OKLAHOMA JUMANJI"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 749); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "RULES HUMAN"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(749); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("RULES HUMAN"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 832); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "SPLASH GUMP"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(832); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("SPLASH GUMP"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 939); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "VERTIGO NORTHWEST"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(939); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("VERTIGO NORTHWEST"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 970); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "WESTWARD SEABISCUIT"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(970); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("WESTWARD SEABISCUIT"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 980); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "WIZARD COLDBLOODED"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(980); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("WIZARD COLDBLOODED"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_1"); - assertEquals(currEdgeContent.getData().getId(), "811_71"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("811_71"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_23"); - assertEquals(currEdgeContent.getData().getTarget(), "7_23"); - assertEquals(currEdgeContent.getData().getId(), "8123_723"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_23"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_23"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8123_723"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_25"); - assertEquals(currEdgeContent.getData().getTarget(), "7_25"); - assertEquals(currEdgeContent.getData().getId(), "8125_725"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_25"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_25"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8125_725"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_106"); - assertEquals(currEdgeContent.getData().getTarget(), "7_106"); - assertEquals(currEdgeContent.getData().getId(), "81106_7106"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_106"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_106"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81106_7106"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_140"); - assertEquals(currEdgeContent.getData().getTarget(), "7_140"); - assertEquals(currEdgeContent.getData().getId(), "81140_7140"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_140"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_140"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81140_7140"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_166"); - assertEquals(currEdgeContent.getData().getTarget(), "7_166"); - assertEquals(currEdgeContent.getData().getId(), "81166_7166"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_166"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_166"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81166_7166"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_277"); - assertEquals(currEdgeContent.getData().getTarget(), "7_277"); - assertEquals(currEdgeContent.getData().getId(), "81277_7277"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_277"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_277"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81277_7277"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_361"); - assertEquals(currEdgeContent.getData().getTarget(), "7_361"); - assertEquals(currEdgeContent.getData().getId(), "81361_7361"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_361"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_361"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81361_7361"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_438"); - assertEquals(currEdgeContent.getData().getTarget(), "7_438"); - assertEquals(currEdgeContent.getData().getId(), "81438_7438"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_438"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_438"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81438_7438"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_499"); - assertEquals(currEdgeContent.getData().getTarget(), "7_499"); - assertEquals(currEdgeContent.getData().getId(), "81499_7499"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_499"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_499"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81499_7499"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_506"); - assertEquals(currEdgeContent.getData().getTarget(), "7_506"); - assertEquals(currEdgeContent.getData().getId(), "81506_7506"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_506"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_506"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81506_7506"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_509"); - assertEquals(currEdgeContent.getData().getTarget(), "7_509"); - assertEquals(currEdgeContent.getData().getId(), "81509_7509"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_509"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_509"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81509_7509"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_605"); - assertEquals(currEdgeContent.getData().getTarget(), "7_605"); - assertEquals(currEdgeContent.getData().getId(), "81605_7605"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_605"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_605"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81605_7605"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_635"); - assertEquals(currEdgeContent.getData().getTarget(), "7_635"); - assertEquals(currEdgeContent.getData().getId(), "81635_7635"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_635"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_635"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81635_7635"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_749"); - assertEquals(currEdgeContent.getData().getTarget(), "7_749"); - assertEquals(currEdgeContent.getData().getId(), "81749_7749"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_749"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_749"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81749_7749"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_832"); - assertEquals(currEdgeContent.getData().getTarget(), "7_832"); - assertEquals(currEdgeContent.getData().getId(), "81832_7832"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_832"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_832"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81832_7832"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_939"); - assertEquals(currEdgeContent.getData().getTarget(), "7_939"); - assertEquals(currEdgeContent.getData().getId(), "81939_7939"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_939"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_939"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81939_7939"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_970"); - assertEquals(currEdgeContent.getData().getTarget(), "7_970"); - assertEquals(currEdgeContent.getData().getId(), "81970_7970"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_970"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_970"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81970_7970"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_980"); - assertEquals(currEdgeContent.getData().getTarget(), "7_980"); - assertEquals(currEdgeContent.getData().getId(), "81980_7980"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_980"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_980"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81980_7980"); /** * Get actors by movie @@ -1641,29 +1638,29 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { rootIds[0] = "7_2"; data = provider.expand(dataSource, rootIds, "in", "has_film", 300); - assertEquals(data.getNodesClasses().size(), 3); - assertEquals(data.getNodes().size(), 8); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 8); + assertThat(data.getNodesClasses().size()).isEqualTo(3); + assertThat(data.getNodes().size()).isEqualTo(8); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(8); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film_actor")); - assertTrue(data.getNodesClasses().containsKey("film_category")); // has_film represents also the relationship: film_category -> film - assertTrue(data.getNodesClasses().containsKey("inventory")); // has_film represents also the relationship: inventory -> film + assertThat(data.getNodesClasses().containsKey("film_actor")).isTrue(); + assertThat(data.getNodesClasses().containsKey("film_category")).isTrue(); // has_film represents also the relationship: film_category -> film + assertThat(data.getNodesClasses().containsKey("inventory")).isTrue(); // has_film represents also the relationship: inventory -> film filmActorClass = data.getNodesClasses().get("film_actor"); - assertTrue(filmActorClass.containsKey("film_id")); - assertTrue(filmActorClass.containsKey("actor_id")); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("film_id")).isTrue(); + assertThat(filmActorClass.containsKey("actor_id")).isTrue(); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); filmActorClass = data.getNodesClasses().get("film_category"); - assertTrue(filmActorClass.containsKey("film_id")); - assertTrue(filmActorClass.containsKey("category_id")); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("film_id")).isTrue(); + assertThat(filmActorClass.containsKey("category_id")).isTrue(); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); Map inventoryClass = data.getNodesClasses().get("inventory"); - assertTrue(inventoryClass.containsKey("inventory_id")); - assertTrue(inventoryClass.containsKey("film_id")); - assertTrue(inventoryClass.containsKey("store_id")); - assertTrue(inventoryClass.containsKey("last_update")); + assertThat(inventoryClass.containsKey("inventory_id")).isTrue(); + assertThat(inventoryClass.containsKey("film_id")).isTrue(); + assertThat(inventoryClass.containsKey("store_id")).isTrue(); + assertThat(inventoryClass.containsKey("last_update")).isTrue(); Set filmActorNodes = data .getNodes() @@ -1681,9 +1678,9 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { .filter(inventoryNode -> inventoryNode.getClasses().equals("inventory")) .collect(Collectors.toSet()); - assertEquals(filmActorNodes.size(), 4); - assertEquals(filmCategoryNodes.size(), 1); - assertEquals(inventoryNodes.size(), 3); + assertThat(filmActorNodes.size()).isEqualTo(4); + assertThat(filmCategoryNodes.size()).isEqualTo(1); + assertThat(inventoryNodes.size()).isEqualTo(3); joinRecordRoots = new String[4]; i = 0; @@ -1696,126 +1693,126 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { data = provider.expand(dataSource, joinRecordRoots, "out", "has_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 4); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 4); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(4); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(4); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); try { currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 19); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "BOB"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "FAWCETT"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:34:33-00").toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(19); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("BOB"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("FAWCETT"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:34:33-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 85); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "MINNIE"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "ZELLWEGER"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:34:33-00").toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(85); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("MINNIE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("ZELLWEGER"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:34:33-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 90); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "SEAN"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "GUINESS"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:34:33-00").toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(90); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("SEAN"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("GUINESS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:34:33-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 160); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "CHRIS"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "DEPP"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(((Date) currRecord.get("last_update")).toInstant(), df.parse("2006-02-15 04:34:33-00").toInstant()); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(160); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("CHRIS"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("DEPP"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(df.parse("2006-02-15 04:34:33-00").toInstant()).isEqualTo(((Date) currRecord.get("last_update")).toInstant()); } catch (ParseException e) { e.printStackTrace(); - fail(); + fail(""); } // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_19_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_19"); - assertEquals(currEdgeContent.getData().getId(), "8192_119"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_19_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_19"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8192_119"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_85_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_85"); - assertEquals(currEdgeContent.getData().getId(), "8852_185"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_85_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_85"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8852_185"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_90_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_90"); - assertEquals(currEdgeContent.getData().getId(), "8902_190"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_90_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_90"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8902_190"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_160_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_160"); - assertEquals(currEdgeContent.getData().getId(), "81602_1160"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_160_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_160"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81602_1160"); } @Override diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderWithAggregationTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderWithAggregationTest.java index 9f3c5fa9..eb653380 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderWithAggregationTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/MysqlSQLDataProviderWithAggregationTest.java @@ -20,10 +20,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.CytoData; import com.arcadeanalytics.provider.DataSourceInfo; @@ -34,7 +32,7 @@ import org.junit.jupiter.api.Test; import org.testcontainers.containers.MySQLContainer; -public class MysqlSQLDataProviderWithAggregationTest extends AbstractRDBMSProviderWithAggregationTest { +class MysqlSQLDataProviderWithAggregationTest extends AbstractRDBMSProviderWithAggregationTest { private DataSourceInfo dataSource = null; @@ -70,14 +68,15 @@ public void setUp() { public void fetchDataThroughTableScanTest() { try { provider.fetchData(dataSource, "select * from film_actor limit 5", 5); - fail(); + fail(""); } catch (Exception e) { String message = e.getMessage(); - assertTrue(message.contains("Wrong query content: the requested table was aggregated into")); + assertThat(message.contains("Wrong query content: the requested table was aggregated into")).isTrue(); } } @Override + @Test public void expandN2NRelationship() { /** * Get movies by actor @@ -87,28 +86,28 @@ public void expandN2NRelationship() { String[] rootIds = { "1_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "film_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film")); + assertThat(data.getNodesClasses().containsKey("film")).isTrue(); Map filmClass = data.getNodesClasses().get("film"); - assertTrue(filmClass.containsKey("film_id")); - assertTrue(filmClass.containsKey("title")); - assertTrue(filmClass.containsKey("description")); - assertTrue(filmClass.containsKey("release_year")); - assertTrue(filmClass.containsKey("language_id")); - assertTrue(filmClass.containsKey("original_language_id")); - assertTrue(filmClass.containsKey("rental_duration")); - assertTrue(filmClass.containsKey("rental_rate")); - assertTrue(filmClass.containsKey("length")); - assertTrue(filmClass.containsKey("replacement_cost")); - assertTrue(filmClass.containsKey("rating")); - assertTrue(filmClass.containsKey("last_update")); - assertTrue(filmClass.containsKey("special_features")); + assertThat(filmClass.containsKey("film_id")).isTrue(); + assertThat(filmClass.containsKey("title")).isTrue(); + assertThat(filmClass.containsKey("description")).isTrue(); + assertThat(filmClass.containsKey("release_year")).isTrue(); + assertThat(filmClass.containsKey("language_id")).isTrue(); + assertThat(filmClass.containsKey("original_language_id")).isTrue(); + assertThat(filmClass.containsKey("rental_duration")).isTrue(); + assertThat(filmClass.containsKey("rental_rate")).isTrue(); + assertThat(filmClass.containsKey("length")).isTrue(); + assertThat(filmClass.containsKey("replacement_cost")).isTrue(); + assertThat(filmClass.containsKey("rating")).isTrue(); + assertThat(filmClass.containsKey("last_update")).isTrue(); + assertThat(filmClass.containsKey("special_features")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -116,445 +115,445 @@ public void expandN2NRelationship() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 1); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ACADEMY DINOSAUR"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(1); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ACADEMY DINOSAUR"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 23); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ANACONDA CONFESSIONS"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(23); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ANACONDA CONFESSIONS"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 25); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ANGELS LIFE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(25); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ANGELS LIFE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 106); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "BULWORTH COMMANDMENTS"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(106); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("BULWORTH COMMANDMENTS"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 140); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "CHEAPER CLYDE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(140); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("CHEAPER CLYDE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 166); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "COLOR PHILADELPHIA"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(166); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("COLOR PHILADELPHIA"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 277); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "ELEPHANT TROJAN"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(277); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("ELEPHANT TROJAN"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 361); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "GLEAMING JAWBREAKER"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(361); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("GLEAMING JAWBREAKER"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 438); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "HUMAN GRAFFITI"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(438); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("HUMAN GRAFFITI"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 499); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "KING EVOLUTION"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(499); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("KING EVOLUTION"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 506); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "LADY STAGE"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(506); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("LADY STAGE"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 509); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "LANGUAGE COWBOY"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(509); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("LANGUAGE COWBOY"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 605); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "MULHOLLAND BEAST"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(605); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("MULHOLLAND BEAST"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 635); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "OKLAHOMA JUMANJI"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(635); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("OKLAHOMA JUMANJI"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 749); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "RULES HUMAN"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(749); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("RULES HUMAN"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 832); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "SPLASH GUMP"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(832); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("SPLASH GUMP"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 939); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "VERTIGO NORTHWEST"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(939); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("VERTIGO NORTHWEST"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 970); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "WESTWARD SEABISCUIT"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(970); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("WESTWARD SEABISCUIT"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 980); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "WIZARD COLDBLOODED"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(980); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("WIZARD COLDBLOODED"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_1"); - assertEquals(currEdgeContent.getData().getId(), "8_1_1"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_1"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_23"); - assertEquals(currEdgeContent.getData().getId(), "8_1_23"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_23"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_23"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_25"); - assertEquals(currEdgeContent.getData().getId(), "8_1_25"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_25"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_25"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_106"); - assertEquals(currEdgeContent.getData().getId(), "8_1_106"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_106"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_106"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_140"); - assertEquals(currEdgeContent.getData().getId(), "8_1_140"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_140"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_140"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_166"); - assertEquals(currEdgeContent.getData().getId(), "8_1_166"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_166"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_166"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_277"); - assertEquals(currEdgeContent.getData().getId(), "8_1_277"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_277"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_277"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_361"); - assertEquals(currEdgeContent.getData().getId(), "8_1_361"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_361"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_361"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_438"); - assertEquals(currEdgeContent.getData().getId(), "8_1_438"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_438"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_438"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_499"); - assertEquals(currEdgeContent.getData().getId(), "8_1_499"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_499"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_499"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_506"); - assertEquals(currEdgeContent.getData().getId(), "8_1_506"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_506"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_506"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_509"); - assertEquals(currEdgeContent.getData().getId(), "8_1_509"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_509"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_509"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_605"); - assertEquals(currEdgeContent.getData().getId(), "8_1_605"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_605"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_605"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_635"); - assertEquals(currEdgeContent.getData().getId(), "8_1_635"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_635"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_635"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_749"); - assertEquals(currEdgeContent.getData().getId(), "8_1_749"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_749"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_749"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_832"); - assertEquals(currEdgeContent.getData().getId(), "8_1_832"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_832"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_832"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_939"); - assertEquals(currEdgeContent.getData().getId(), "8_1_939"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_939"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_939"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_970"); - assertEquals(currEdgeContent.getData().getId(), "8_1_970"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_970"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_970"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_980"); - assertEquals(currEdgeContent.getData().getId(), "8_1_980"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_980"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_980"); /** * Get actors by movie @@ -565,124 +564,124 @@ public void expandN2NRelationship() { rootIds[0] = "7_2"; data = provider.expand(dataSource, rootIds, "in", "film_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 4); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 4); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(4); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(4); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 19); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "BOB"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "FAWCETT"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(19); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("BOB"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("FAWCETT"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 85); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "MINNIE"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "ZELLWEGER"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(85); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("MINNIE"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("ZELLWEGER"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 90); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "SEAN"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "GUINESS"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(90); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("SEAN"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("GUINESS"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 160); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "CHRIS"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "DEPP"); - assertTrue(currRecord.containsKey("last_update")); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(160); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("CHRIS"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("DEPP"); + assertThat(currRecord.containsKey("last_update")).isTrue(); // assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_19"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_19_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_19"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_19_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_85"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_85_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_85"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_85_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_90"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_90_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_90"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_90_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_160"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_160_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_160"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_160_2"); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderTest.java index 5c143ec5..7e08a644 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderTest.java @@ -20,10 +20,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.CytoData; import com.arcadeanalytics.provider.DataSourceInfo; @@ -39,7 +37,7 @@ import org.junit.jupiter.api.Test; import org.testcontainers.containers.PostgreSQLContainer; -public class PostgreSQLDataProviderTest extends AbstractRDBMSProviderTest { +class PostgreSQLDataProviderTest extends AbstractRDBMSProviderTest { private DataSourceInfo dataSource; @@ -76,19 +74,19 @@ public void setUp() throws Exception { public void fetchDataThroughTableScanTest() { GraphData data = provider.fetchData(dataSource, "select * from actor limit 5", 5); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -96,69 +94,69 @@ public void fetchDataThroughTableScanTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Penelope"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Guiness"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Penelope"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Guiness"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 2); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Nick"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Wahlberg"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Nick"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Wahlberg"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 3); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Ed"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Chase"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Ed"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Chase"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 4); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Jennifer"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Davis"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Jennifer"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Davis"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 5); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Johnny"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Lollobrigida"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Johnny"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Lollobrigida"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); } @Override @@ -175,25 +173,25 @@ public void loadVerticesFromIdsMultipleTablesTest() { GraphData data = provider.load(dataSource, ids); - assertEquals(data.getNodesClasses().size(), 2); - assertEquals(data.getNodes().size(), 7); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(2); + assertThat(data.getNodes().size()).isEqualTo(7); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); - assertTrue(data.getNodesClasses().containsKey("store")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); + assertThat(data.getNodesClasses().containsKey("store")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); Map storeClass = data.getNodesClasses().get("store"); - assertTrue(storeClass.containsKey("store_id")); - assertTrue(storeClass.containsKey("manager_staff_id")); - assertTrue(storeClass.containsKey("address_id")); - assertTrue(storeClass.containsKey("last_update")); + assertThat(storeClass.containsKey("store_id")).isTrue(); + assertThat(storeClass.containsKey("manager_staff_id")).isTrue(); + assertThat(storeClass.containsKey("address_id")).isTrue(); + assertThat(storeClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -201,95 +199,95 @@ public void loadVerticesFromIdsMultipleTablesTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Penelope"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Guiness"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Penelope"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Guiness"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 2); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Nick"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Wahlberg"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Nick"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Wahlberg"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 3); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Ed"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Chase"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Ed"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Chase"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 4); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Jennifer"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Davis"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Jennifer"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Davis"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 5); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Johnny"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Lollobrigida"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Johnny"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Lollobrigida"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 1); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 1); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:57:12.0"); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(1); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:57:12.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 2); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 2); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 2); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:57:12.0"); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(2); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(2); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(2); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:57:12.0"); } @Override @@ -306,19 +304,19 @@ public void loadVerticesFromIdsSingleTableTest() { GraphData data = provider.load(dataSource, actorIds); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -326,69 +324,69 @@ public void loadVerticesFromIdsSingleTableTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Penelope"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Guiness"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Penelope"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Guiness"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 2); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Nick"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Wahlberg"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(2); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Nick"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Wahlberg"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 3); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Ed"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Chase"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(3); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Ed"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Chase"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 4); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Jennifer"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Davis"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(4); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Jennifer"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Davis"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 5); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Johnny"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Lollobrigida"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(5); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Johnny"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Lollobrigida"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); /* * Fetching 2 vertices from the store table by cyto-ids @@ -400,48 +398,48 @@ public void loadVerticesFromIdsSingleTableTest() { String[] storeIds = { "15_1", "15_2" }; data = provider.load(dataSource, storeIds); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 2); - assertEquals(data.getEdgesClasses().size(), 0); - assertEquals(data.getEdges().size(), 0); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(2); + assertThat(data.getEdgesClasses().size()).isEqualTo(0); + assertThat(data.getEdges().size()).isEqualTo(0); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("store")); + assertThat(data.getNodesClasses().containsKey("store")).isTrue(); Map storeClass = data.getNodesClasses().get("store"); - assertTrue(storeClass.containsKey("store_id")); - assertTrue(storeClass.containsKey("manager_staff_id")); - assertTrue(storeClass.containsKey("address_id")); - assertTrue(storeClass.containsKey("last_update")); + assertThat(storeClass.containsKey("store_id")).isTrue(); + assertThat(storeClass.containsKey("manager_staff_id")).isTrue(); + assertThat(storeClass.containsKey("address_id")).isTrue(); + assertThat(storeClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 1); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 1); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:57:12.0"); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(1); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:57:12.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 2); - assertTrue(currRecord.containsKey("manager_staff_id")); - assertEquals(currRecord.get("manager_staff_id"), 2); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 2); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:57:12.0"); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(2); + assertThat(currRecord.containsKey("manager_staff_id")).isTrue(); + assertThat(currRecord.get("manager_staff_id")).isEqualTo(2); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(2); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:57:12.0"); } @Override @@ -475,31 +473,31 @@ public void expand1To1RelWithSimpleFKTest() { st.execute(distributionCountryFilling); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } String[] rootIds = { "7_1", "7_2", "7_3", "7_4", "7_5", "7_6" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_distribution_language", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 6); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 6); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(6); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(6); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("language")); + assertThat(data.getNodesClasses().containsKey("language")).isTrue(); Map languageClass = data.getNodesClasses().get("language"); - assertTrue(languageClass.containsKey("language_id")); - assertTrue(languageClass.containsKey("name")); - assertTrue(languageClass.containsKey("last_update")); + assertThat(languageClass.containsKey("language_id")).isTrue(); + assertThat(languageClass.containsKey("name")).isTrue(); + assertThat(languageClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -507,140 +505,140 @@ public void expand1To1RelWithSimpleFKTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 1); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "English"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(1); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("English"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 2); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Italian"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(2); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Italian"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 3); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Japanese"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(3); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Japanese"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 4); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "Mandarin"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(4); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("Mandarin"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 5); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "French"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(5); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("French"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("language_id")); - assertEquals(currRecord.get("language_id"), 6); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")).trim(), "German"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 10:02:19.0"); + assertThat(currRecord.containsKey("language_id")).isTrue(); + assertThat(currRecord.get("language_id")).isEqualTo(6); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name")).trim()).isEqualTo("German"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 10:02:19.0"); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_1"); - assertEquals(currEdgeContent.getData().getTarget(), "12_1"); - assertEquals(currEdgeContent.getData().getId(), "71_121"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("71_121"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_2"); - assertEquals(currEdgeContent.getData().getTarget(), "12_2"); - assertEquals(currEdgeContent.getData().getId(), "72_122"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("72_122"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_3"); - assertEquals(currEdgeContent.getData().getTarget(), "12_3"); - assertEquals(currEdgeContent.getData().getId(), "73_123"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_3"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_3"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("73_123"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_4"); - assertEquals(currEdgeContent.getData().getTarget(), "12_4"); - assertEquals(currEdgeContent.getData().getId(), "74_124"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_4"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_4"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("74_124"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_5"); - assertEquals(currEdgeContent.getData().getTarget(), "12_5"); - assertEquals(currEdgeContent.getData().getId(), "75_125"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_5"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_5"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("75_125"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_6"); - assertEquals(currEdgeContent.getData().getTarget(), "12_6"); - assertEquals(currEdgeContent.getData().getId(), "76_126"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_6"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_6"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("76_126"); // 1-1 Relationship: language <-[has_distribution_language]- distribution_country @@ -652,155 +650,155 @@ public void expand1To1RelWithSimpleFKTest() { rootIds[5] = "12_6"; data = provider.expand(dataSource, rootIds, "in", "has_distribution_language", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 6); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 6); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(6); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(6); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("distribution_country")); + assertThat(data.getNodesClasses().containsKey("distribution_country")).isTrue(); Map distributionCountryClass = data.getNodesClasses().get("distribution_country"); - assertTrue(distributionCountryClass.containsKey("distribution_country_id")); - assertTrue(distributionCountryClass.containsKey("name")); - assertTrue(distributionCountryClass.containsKey("distribution_language")); + assertThat(distributionCountryClass.containsKey("distribution_country_id")).isTrue(); + assertThat(distributionCountryClass.containsKey("name")).isTrue(); + assertThat(distributionCountryClass.containsKey("distribution_language")).isTrue(); it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 1); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "USA"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 1); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(1); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("USA"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(1); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 2); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Italy"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 2); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(2); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Italy"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(2); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 3); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Japan"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 3); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(3); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Japan"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(3); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 4); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "China"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 4); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(4); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("China"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(4); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 5); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "France"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 5); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(5); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("France"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(5); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("distribution_country_id")); - assertEquals(currRecord.get("distribution_country_id"), 6); - assertTrue(currRecord.containsKey("name")); - assertEquals(((String) currRecord.get("name")), "Germany"); - assertTrue(currRecord.containsKey("distribution_language")); - assertEquals(currRecord.get("distribution_language"), 6); + assertThat(currRecord.containsKey("distribution_country_id")).isTrue(); + assertThat(currRecord.get("distribution_country_id")).isEqualTo(6); + assertThat(currRecord.containsKey("name")).isTrue(); + assertThat(((String) currRecord.get("name"))).isEqualTo("Germany"); + assertThat(currRecord.containsKey("distribution_language")).isTrue(); + assertThat(currRecord.get("distribution_language")).isEqualTo(6); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_1"); - assertEquals(currEdgeContent.getData().getTarget(), "12_1"); - assertEquals(currEdgeContent.getData().getId(), "71_121"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("71_121"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_2"); - assertEquals(currEdgeContent.getData().getTarget(), "12_2"); - assertEquals(currEdgeContent.getData().getId(), "72_122"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("72_122"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_3"); - assertEquals(currEdgeContent.getData().getTarget(), "12_3"); - assertEquals(currEdgeContent.getData().getId(), "73_123"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_3"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_3"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("73_123"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_4"); - assertEquals(currEdgeContent.getData().getTarget(), "12_4"); - assertEquals(currEdgeContent.getData().getId(), "74_124"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_4"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_4"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("74_124"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_5"); - assertEquals(currEdgeContent.getData().getTarget(), "12_5"); - assertEquals(currEdgeContent.getData().getId(), "75_125"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_5"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_5"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("75_125"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_distribution_language"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "7_6"); - assertEquals(currEdgeContent.getData().getTarget(), "12_6"); - assertEquals(currEdgeContent.getData().getId(), "76_126"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_distribution_language"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("7_6"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("12_6"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("76_126"); // dropping the new added table try { @@ -811,13 +809,13 @@ public void expand1To1RelWithSimpleFKTest() { st.execute(deleteDistributionCountryTable); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } @@ -830,18 +828,18 @@ public void expand1ToNRelWithSimpleFKTest() { String[] rootIds = { "4_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_country", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 1); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 1); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(1); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(1); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("country")); + assertThat(data.getNodesClasses().containsKey("country")).isTrue(); Map customerClass = data.getNodesClasses().get("country"); - assertTrue(customerClass.containsKey("country_id")); - assertTrue(customerClass.containsKey("country")); - assertTrue(customerClass.containsKey("last_update")); + assertThat(customerClass.containsKey("country_id")).isTrue(); + assertThat(customerClass.containsKey("country")).isTrue(); + assertThat(customerClass.containsKey("last_update")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -849,167 +847,167 @@ public void expand1ToNRelWithSimpleFKTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("country")); - assertEquals(currRecord.get("country"), "Spain"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:44:00.0"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("country")).isTrue(); + assertThat(currRecord.get("country")).isEqualTo("Spain"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:44:00.0"); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); + assertThat(currRecord.size()).isEqualTo(0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_1"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "41_587"); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("41_587"); // 1-N Relationship: city <-[has_country]- country rootIds[0] = "5_87"; data = provider.expand(dataSource, rootIds, "in", "has_country", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 5); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 5); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(5); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(5); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 1); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "A Corua (La Corua)"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:45:25.0"); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(1); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("A Corua (La Corua)"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:45:25.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 146); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Donostia-San Sebastin"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:45:25.0"); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(146); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Donostia-San Sebastin"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:45:25.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 181); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Gijn"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:45:25.0"); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(181); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Gijn"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:45:25.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 388); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Ourense (Orense)"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:45:25.0"); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(388); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Ourense (Orense)"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:45:25.0"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("city_id")); - assertEquals(currRecord.get("city_id"), 459); - assertTrue(currRecord.containsKey("city")); - assertEquals(currRecord.get("city"), "Santiago de Compostela"); - assertTrue(currRecord.containsKey("country_id")); - assertEquals(currRecord.get("country_id"), 87); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2006-02-15 09:45:25.0"); + assertThat(currRecord.containsKey("city_id")).isTrue(); + assertThat(currRecord.get("city_id")).isEqualTo(459); + assertThat(currRecord.containsKey("city")).isTrue(); + assertThat(currRecord.get("city")).isEqualTo("Santiago de Compostela"); + assertThat(currRecord.containsKey("country_id")).isTrue(); + assertThat(currRecord.get("country_id")).isEqualTo(87); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2006-02-15 09:45:25.0"); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_1"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "41_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("41_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_146"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4146_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_146"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4146_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_181"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4181_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_181"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4181_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_388"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4388_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_388"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4388_587"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_country"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "4_459"); - assertEquals(currEdgeContent.getData().getTarget(), "5_87"); - assertEquals(currEdgeContent.getData().getId(), "4459_587"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_country"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("4_459"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("5_87"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("4459_587"); } @Override @@ -1020,24 +1018,24 @@ public void expandMultiple1ToNRelWithSimpleFKTest() { String[] rootIds = { "13_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "has_customer", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 1); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 1); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(1); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(1); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("customer")); + assertThat(data.getNodesClasses().containsKey("customer")).isTrue(); Map customerClass = data.getNodesClasses().get("customer"); - assertTrue(customerClass.containsKey("customer_id")); - assertTrue(customerClass.containsKey("store_id")); - assertTrue(customerClass.containsKey("first_name")); - assertTrue(customerClass.containsKey("last_name")); - assertTrue(customerClass.containsKey("email")); - assertTrue(customerClass.containsKey("address_id")); - assertTrue(customerClass.containsKey("create_date")); - assertTrue(customerClass.containsKey("last_update")); - assertTrue(customerClass.containsKey("active")); + assertThat(customerClass.containsKey("customer_id")).isTrue(); + assertThat(customerClass.containsKey("store_id")).isTrue(); + assertThat(customerClass.containsKey("first_name")).isTrue(); + assertThat(customerClass.containsKey("last_name")).isTrue(); + assertThat(customerClass.containsKey("email")).isTrue(); + assertThat(customerClass.containsKey("address_id")).isTrue(); + assertThat(customerClass.containsKey("create_date")).isTrue(); + assertThat(customerClass.containsKey("last_update")).isTrue(); + assertThat(customerClass.containsKey("active")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -1045,66 +1043,66 @@ public void expandMultiple1ToNRelWithSimpleFKTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("customer_id")); - assertEquals(currRecord.get("customer_id"), 130); - assertTrue(currRecord.containsKey("store_id")); - assertEquals(currRecord.get("store_id"), 1); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Charlotte"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Hunter"); - assertTrue(currRecord.containsKey("email")); - assertEquals(currRecord.get("email"), "charlotte.hunter@sakilacustomer.org"); - assertTrue(currRecord.containsKey("address_id")); - assertEquals(currRecord.get("address_id"), 134); - assertTrue(currRecord.containsKey("activebool")); - assertEquals(currRecord.get("activebool"), true); - assertTrue(currRecord.containsKey("create_date")); - assertEquals(currRecord.get("create_date").toString(), "2006-02-14"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:49:45.738"); - assertTrue(currRecord.containsKey("active")); - assertEquals(currRecord.get("active"), 1); + assertThat(currRecord.containsKey("customer_id")).isTrue(); + assertThat(currRecord.get("customer_id")).isEqualTo(130); + assertThat(currRecord.containsKey("store_id")).isTrue(); + assertThat(currRecord.get("store_id")).isEqualTo(1); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Charlotte"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Hunter"); + assertThat(currRecord.containsKey("email")).isTrue(); + assertThat(currRecord.get("email")).isEqualTo("charlotte.hunter@sakilacustomer.org"); + assertThat(currRecord.containsKey("address_id")).isTrue(); + assertThat(currRecord.get("address_id")).isEqualTo(134); + assertThat(currRecord.containsKey("activebool")).isTrue(); + assertThat(currRecord.get("activebool")).isEqualTo(true); + assertThat(currRecord.containsKey("create_date")).isTrue(); + assertThat(currRecord.get("create_date").toString()).isEqualTo("2006-02-14"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:49:45.738"); + assertThat(currRecord.containsKey("active")).isTrue(); + assertThat(currRecord.get("active")).isEqualTo(1); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); + assertThat(currRecord.size()).isEqualTo(0); - assertEquals(currEdgeContent.getClasses(), "has_customer"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "13_1"); - assertEquals(currEdgeContent.getData().getTarget(), "6_130"); - assertEquals(currEdgeContent.getData().getId(), "131_6130"); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_customer"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("13_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("6_130"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("131_6130"); // 1-N Relationship: customer <-[has_customer]- rental rootIds[0] = "6_130"; data = provider.expand(dataSource, rootIds, "in", "has_customer", 300); - assertEquals(data.getNodesClasses().size(), 2); - assertEquals(data.getNodes().size(), 46); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 46); + assertThat(data.getNodesClasses().size()).isEqualTo(2); + assertThat(data.getNodes().size()).isEqualTo(46); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(46); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("rental")); - assertTrue(data.getNodesClasses().containsKey("payment")); // has_customer represents also the relationship: Payment -> Customer + assertThat(data.getNodesClasses().containsKey("rental")).isTrue(); + assertThat(data.getNodesClasses().containsKey("payment")).isTrue(); // has_customer represents also the relationship: Payment -> Customer // nodes checks Set rentalNodes = data.getNodes().stream().filter(rentalNode -> rentalNode.getClasses().equals("rental")).collect(Collectors.toSet()); Set paymentNodes = data.getNodes().stream().filter(rentalNode -> rentalNode.getClasses().equals("payment")).collect(Collectors.toSet()); - assertEquals(rentalNodes.size(), 24); - assertEquals(paymentNodes.size(), 22); + assertThat(rentalNodes.size()).isEqualTo(24); + assertThat(paymentNodes.size()).isEqualTo(22); } @Override @@ -1118,16 +1116,16 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { String[] rootIds = { "1_1" }; GraphData data = provider.expand(dataSource, rootIds, "in", "has_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film_actor")); + assertThat(data.getNodesClasses().containsKey("film_actor")).isTrue(); Map filmActorClass = data.getNodesClasses().get("film_actor"); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); String[] joinRecordRoots = new String[19]; int i = 0; @@ -1140,28 +1138,28 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { data = provider.expand(dataSource, joinRecordRoots, "out", "has_film", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film")); + assertThat(data.getNodesClasses().containsKey("film")).isTrue(); Map filmClass = data.getNodesClasses().get("film"); - assertTrue(filmClass.containsKey("film_id")); - assertTrue(filmClass.containsKey("title")); - assertTrue(filmClass.containsKey("description")); - assertTrue(filmClass.containsKey("release_year")); - assertTrue(filmClass.containsKey("language_id")); - assertTrue(filmClass.containsKey("rental_duration")); - assertTrue(filmClass.containsKey("rental_rate")); - assertTrue(filmClass.containsKey("length")); - assertTrue(filmClass.containsKey("replacement_cost")); - assertTrue(filmClass.containsKey("rating")); - assertTrue(filmClass.containsKey("last_update")); - assertTrue(filmClass.containsKey("special_features")); - assertTrue(filmClass.containsKey("fulltext")); + assertThat(filmClass.containsKey("film_id")).isTrue(); + assertThat(filmClass.containsKey("title")).isTrue(); + assertThat(filmClass.containsKey("description")).isTrue(); + assertThat(filmClass.containsKey("release_year")).isTrue(); + assertThat(filmClass.containsKey("language_id")).isTrue(); + assertThat(filmClass.containsKey("rental_duration")).isTrue(); + assertThat(filmClass.containsKey("rental_rate")).isTrue(); + assertThat(filmClass.containsKey("length")).isTrue(); + assertThat(filmClass.containsKey("replacement_cost")).isTrue(); + assertThat(filmClass.containsKey("rating")).isTrue(); + assertThat(filmClass.containsKey("last_update")).isTrue(); + assertThat(filmClass.containsKey("special_features")).isTrue(); + assertThat(filmClass.containsKey("fulltext")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -1169,426 +1167,426 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 1); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Academy Dinosaur"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(1); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Academy Dinosaur"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 23); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Anaconda Confessions"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(23); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Anaconda Confessions"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 25); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Angels Life"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(25); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Angels Life"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 106); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Bulworth Commandments"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(106); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Bulworth Commandments"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 140); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Cheaper Clyde"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(140); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Cheaper Clyde"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 166); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Color Philadelphia"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(166); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Color Philadelphia"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 277); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Elephant Trojan"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(277); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Elephant Trojan"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 361); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Gleaming Jawbreaker"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(361); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Gleaming Jawbreaker"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 438); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Human Graffiti"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(438); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Human Graffiti"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 499); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "King Evolution"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(499); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("King Evolution"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 506); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Lady Stage"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(506); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Lady Stage"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 509); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Language Cowboy"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(509); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Language Cowboy"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 605); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Mulholland Beast"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(605); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Mulholland Beast"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 635); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Oklahoma Jumanji"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(635); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Oklahoma Jumanji"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 749); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Rules Human"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(749); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Rules Human"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 832); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Splash Gump"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(832); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Splash Gump"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 939); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Vertigo Northwest"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(939); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Vertigo Northwest"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 970); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Westward Seabiscuit"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(970); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Westward Seabiscuit"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 980); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Wizard Coldblooded"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(980); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Wizard Coldblooded"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_1"); - assertEquals(currEdgeContent.getData().getId(), "811_71"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("811_71"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_23"); - assertEquals(currEdgeContent.getData().getTarget(), "7_23"); - assertEquals(currEdgeContent.getData().getId(), "8123_723"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_23"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_23"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8123_723"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_25"); - assertEquals(currEdgeContent.getData().getTarget(), "7_25"); - assertEquals(currEdgeContent.getData().getId(), "8125_725"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_25"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_25"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8125_725"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_106"); - assertEquals(currEdgeContent.getData().getTarget(), "7_106"); - assertEquals(currEdgeContent.getData().getId(), "81106_7106"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_106"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_106"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81106_7106"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_140"); - assertEquals(currEdgeContent.getData().getTarget(), "7_140"); - assertEquals(currEdgeContent.getData().getId(), "81140_7140"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_140"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_140"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81140_7140"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_166"); - assertEquals(currEdgeContent.getData().getTarget(), "7_166"); - assertEquals(currEdgeContent.getData().getId(), "81166_7166"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_166"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_166"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81166_7166"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_277"); - assertEquals(currEdgeContent.getData().getTarget(), "7_277"); - assertEquals(currEdgeContent.getData().getId(), "81277_7277"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_277"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_277"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81277_7277"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_361"); - assertEquals(currEdgeContent.getData().getTarget(), "7_361"); - assertEquals(currEdgeContent.getData().getId(), "81361_7361"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_361"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_361"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81361_7361"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_438"); - assertEquals(currEdgeContent.getData().getTarget(), "7_438"); - assertEquals(currEdgeContent.getData().getId(), "81438_7438"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_438"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_438"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81438_7438"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_499"); - assertEquals(currEdgeContent.getData().getTarget(), "7_499"); - assertEquals(currEdgeContent.getData().getId(), "81499_7499"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_499"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_499"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81499_7499"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_506"); - assertEquals(currEdgeContent.getData().getTarget(), "7_506"); - assertEquals(currEdgeContent.getData().getId(), "81506_7506"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_506"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_506"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81506_7506"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_509"); - assertEquals(currEdgeContent.getData().getTarget(), "7_509"); - assertEquals(currEdgeContent.getData().getId(), "81509_7509"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_509"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_509"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81509_7509"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_605"); - assertEquals(currEdgeContent.getData().getTarget(), "7_605"); - assertEquals(currEdgeContent.getData().getId(), "81605_7605"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_605"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_605"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81605_7605"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_635"); - assertEquals(currEdgeContent.getData().getTarget(), "7_635"); - assertEquals(currEdgeContent.getData().getId(), "81635_7635"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_635"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_635"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81635_7635"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_749"); - assertEquals(currEdgeContent.getData().getTarget(), "7_749"); - assertEquals(currEdgeContent.getData().getId(), "81749_7749"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_749"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_749"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81749_7749"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_832"); - assertEquals(currEdgeContent.getData().getTarget(), "7_832"); - assertEquals(currEdgeContent.getData().getId(), "81832_7832"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_832"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_832"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81832_7832"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_939"); - assertEquals(currEdgeContent.getData().getTarget(), "7_939"); - assertEquals(currEdgeContent.getData().getId(), "81939_7939"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_939"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_939"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81939_7939"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_970"); - assertEquals(currEdgeContent.getData().getTarget(), "7_970"); - assertEquals(currEdgeContent.getData().getId(), "81970_7970"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_970"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_970"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81970_7970"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_film"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_1_980"); - assertEquals(currEdgeContent.getData().getTarget(), "7_980"); - assertEquals(currEdgeContent.getData().getId(), "81980_7980"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_film"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_1_980"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_980"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81980_7980"); /** * Get actors by movie @@ -1599,25 +1597,25 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { rootIds[0] = "7_2"; data = provider.expand(dataSource, rootIds, "in", "has_film", 300); - assertEquals(data.getNodesClasses().size(), 3); - assertEquals(data.getNodes().size(), 8); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 8); + assertThat(data.getNodesClasses().size()).isEqualTo(3); + assertThat(data.getNodes().size()).isEqualTo(8); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(8); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film_actor")); - assertTrue(data.getNodesClasses().containsKey("film_category")); // has_film represents also the relationship: film_category -> film - assertTrue(data.getNodesClasses().containsKey("inventory")); // has_film represents also the relationship: inventory -> film + assertThat(data.getNodesClasses().containsKey("film_actor")).isTrue(); + assertThat(data.getNodesClasses().containsKey("film_category")).isTrue(); // has_film represents also the relationship: film_category -> film + assertThat(data.getNodesClasses().containsKey("inventory")).isTrue(); // has_film represents also the relationship: inventory -> film filmActorClass = data.getNodesClasses().get("film_actor"); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); filmActorClass = data.getNodesClasses().get("film_category"); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); filmActorClass = data.getNodesClasses().get("inventory"); - assertTrue(filmActorClass.containsKey("inventory_id")); - assertTrue(filmActorClass.containsKey("film_id")); - assertTrue(filmActorClass.containsKey("store_id")); - assertTrue(filmActorClass.containsKey("last_update")); + assertThat(filmActorClass.containsKey("inventory_id")).isTrue(); + assertThat(filmActorClass.containsKey("film_id")).isTrue(); + assertThat(filmActorClass.containsKey("store_id")).isTrue(); + assertThat(filmActorClass.containsKey("last_update")).isTrue(); Set filmActorNodes = data .getNodes() @@ -1635,9 +1633,9 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { .filter(inventoryNode -> inventoryNode.getClasses().equals("inventory")) .collect(Collectors.toSet()); - assertEquals(filmActorNodes.size(), 4); - assertEquals(filmCategoryNodes.size(), 1); - assertEquals(inventoryNodes.size(), 3); + assertThat(filmActorNodes.size()).isEqualTo(4); + assertThat(filmCategoryNodes.size()).isEqualTo(1); + assertThat(inventoryNodes.size()).isEqualTo(3); joinRecordRoots = new String[4]; i = 0; @@ -1650,121 +1648,121 @@ public void expand1ToNRelWithJoinTableAndSimpleFKTest() { data = provider.expand(dataSource, joinRecordRoots, "out", "has_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 4); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 4); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(4); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(4); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 19); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Bob"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Fawcett"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(19); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Bob"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Fawcett"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 85); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Minnie"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Zellweger"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(85); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Minnie"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Zellweger"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 90); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Sean"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Guiness"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(90); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Sean"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Guiness"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 160); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Chris"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Depp"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(160); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Chris"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Depp"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_19_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_19"); - assertEquals(currEdgeContent.getData().getId(), "8192_119"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_19_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_19"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8192_119"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_85_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_85"); - assertEquals(currEdgeContent.getData().getId(), "8852_185"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_85_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_85"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8852_185"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_90_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_90"); - assertEquals(currEdgeContent.getData().getId(), "8902_190"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_90_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_90"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8902_190"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 0); - assertEquals(currEdgeContent.getClasses(), "has_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "8_160_2"); - assertEquals(currEdgeContent.getData().getTarget(), "1_160"); - assertEquals(currEdgeContent.getData().getId(), "81602_1160"); + assertThat(currRecord.size()).isEqualTo(0); + assertThat(currEdgeContent.getClasses()).isEqualTo("has_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("8_160_2"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("1_160"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("81602_1160"); } @Override diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderWithAggregationTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderWithAggregationTest.java index d41fa77b..3e26520f 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderWithAggregationTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/dataprovider/PostgreSQLDataProviderWithAggregationTest.java @@ -20,10 +20,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.CytoData; import com.arcadeanalytics.provider.DataSourceInfo; @@ -34,7 +32,7 @@ import org.junit.jupiter.api.Test; import org.testcontainers.containers.PostgreSQLContainer; -public class PostgreSQLDataProviderWithAggregationTest extends AbstractRDBMSProviderWithAggregationTest { +class PostgreSQLDataProviderWithAggregationTest extends AbstractRDBMSProviderWithAggregationTest { private DataSourceInfo dataSource; @@ -71,10 +69,10 @@ public void setUp() { public void fetchDataThroughTableScanTest() { try { provider.fetchData(dataSource, "select * from film_actor limit 5", 5); - fail(); + fail(""); } catch (Exception e) { String message = e.getMessage(); - assertTrue(message.contains("Wrong query content: the requested table was aggregated into")); + assertThat(message.contains("Wrong query content: the requested table was aggregated into")).isTrue(); } } @@ -89,28 +87,28 @@ public void expandN2NRelationship() { String[] rootIds = { "1_1" }; GraphData data = provider.expand(dataSource, rootIds, "out", "film_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 19); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 19); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(19); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(19); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("film")); + assertThat(data.getNodesClasses().containsKey("film")).isTrue(); Map filmClass = data.getNodesClasses().get("film"); - assertTrue(filmClass.containsKey("film_id")); - assertTrue(filmClass.containsKey("title")); - assertTrue(filmClass.containsKey("description")); - assertTrue(filmClass.containsKey("release_year")); - assertTrue(filmClass.containsKey("language_id")); - assertTrue(filmClass.containsKey("rental_duration")); - assertTrue(filmClass.containsKey("rental_rate")); - assertTrue(filmClass.containsKey("length")); - assertTrue(filmClass.containsKey("replacement_cost")); - assertTrue(filmClass.containsKey("rating")); - assertTrue(filmClass.containsKey("last_update")); - assertTrue(filmClass.containsKey("special_features")); - assertTrue(filmClass.containsKey("fulltext")); + assertThat(filmClass.containsKey("film_id")).isTrue(); + assertThat(filmClass.containsKey("title")).isTrue(); + assertThat(filmClass.containsKey("description")).isTrue(); + assertThat(filmClass.containsKey("release_year")).isTrue(); + assertThat(filmClass.containsKey("language_id")).isTrue(); + assertThat(filmClass.containsKey("rental_duration")).isTrue(); + assertThat(filmClass.containsKey("rental_rate")).isTrue(); + assertThat(filmClass.containsKey("length")).isTrue(); + assertThat(filmClass.containsKey("replacement_cost")).isTrue(); + assertThat(filmClass.containsKey("rating")).isTrue(); + assertThat(filmClass.containsKey("last_update")).isTrue(); + assertThat(filmClass.containsKey("special_features")).isTrue(); + assertThat(filmClass.containsKey("fulltext")).isTrue(); // nodes checks Iterator it = data.getNodes().iterator(); @@ -118,445 +116,445 @@ public void expandN2NRelationship() { Map currRecord; currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 1); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Academy Dinosaur"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(1); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Academy Dinosaur"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 23); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Anaconda Confessions"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(23); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Anaconda Confessions"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 25); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Angels Life"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(25); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Angels Life"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 106); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Bulworth Commandments"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(106); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Bulworth Commandments"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 140); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Cheaper Clyde"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(140); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Cheaper Clyde"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 166); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Color Philadelphia"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(166); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Color Philadelphia"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 277); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Elephant Trojan"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(277); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Elephant Trojan"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 361); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Gleaming Jawbreaker"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(361); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Gleaming Jawbreaker"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 438); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Human Graffiti"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(438); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Human Graffiti"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 499); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "King Evolution"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(499); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("King Evolution"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 506); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Lady Stage"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(506); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Lady Stage"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 509); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Language Cowboy"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(509); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Language Cowboy"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 605); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Mulholland Beast"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(605); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Mulholland Beast"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 635); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Oklahoma Jumanji"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(635); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Oklahoma Jumanji"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 749); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Rules Human"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(749); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Rules Human"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 832); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Splash Gump"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(832); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Splash Gump"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 939); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Vertigo Northwest"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(939); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Vertigo Northwest"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 970); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Westward Seabiscuit"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(970); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Westward Seabiscuit"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("film_id")); - assertEquals(currRecord.get("film_id"), 980); - assertTrue(currRecord.containsKey("title")); - assertEquals(currRecord.get("title"), "Wizard Coldblooded"); - assertTrue(currRecord.containsKey("description")); - assertNotNull(currRecord.get("description")); + assertThat(currRecord.containsKey("film_id")).isTrue(); + assertThat(currRecord.get("film_id")).isEqualTo(980); + assertThat(currRecord.containsKey("title")).isTrue(); + assertThat(currRecord.get("title")).isEqualTo("Wizard Coldblooded"); + assertThat(currRecord.containsKey("description")).isTrue(); + assertThat(currRecord.get("description")).isNotNull(); // edges checks it = data.getEdges().iterator(); CytoData currEdgeContent; currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_1"); - assertEquals(currEdgeContent.getData().getId(), "8_1_1"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_1"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_1"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_23"); - assertEquals(currEdgeContent.getData().getId(), "8_1_23"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_23"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_23"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_25"); - assertEquals(currEdgeContent.getData().getId(), "8_1_25"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_25"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_25"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_106"); - assertEquals(currEdgeContent.getData().getId(), "8_1_106"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_106"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_106"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_140"); - assertEquals(currEdgeContent.getData().getId(), "8_1_140"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_140"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_140"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_166"); - assertEquals(currEdgeContent.getData().getId(), "8_1_166"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_166"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_166"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_277"); - assertEquals(currEdgeContent.getData().getId(), "8_1_277"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_277"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_277"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_361"); - assertEquals(currEdgeContent.getData().getId(), "8_1_361"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_361"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_361"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_438"); - assertEquals(currEdgeContent.getData().getId(), "8_1_438"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_438"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_438"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_499"); - assertEquals(currEdgeContent.getData().getId(), "8_1_499"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_499"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_499"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_506"); - assertEquals(currEdgeContent.getData().getId(), "8_1_506"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_506"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_506"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_509"); - assertEquals(currEdgeContent.getData().getId(), "8_1_509"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_509"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_509"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_605"); - assertEquals(currEdgeContent.getData().getId(), "8_1_605"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_605"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_605"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_635"); - assertEquals(currEdgeContent.getData().getId(), "8_1_635"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_635"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_635"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_749"); - assertEquals(currEdgeContent.getData().getId(), "8_1_749"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_749"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_749"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_832"); - assertEquals(currEdgeContent.getData().getId(), "8_1_832"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_832"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_832"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_939"); - assertEquals(currEdgeContent.getData().getId(), "8_1_939"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_939"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_939"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_970"); - assertEquals(currEdgeContent.getData().getId(), "8_1_970"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_970"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_970"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_1"); - assertEquals(currEdgeContent.getData().getTarget(), "7_980"); - assertEquals(currEdgeContent.getData().getId(), "8_1_980"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_1"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_980"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_1_980"); /** * Get actors by movie @@ -567,124 +565,124 @@ public void expandN2NRelationship() { rootIds[0] = "7_2"; data = provider.expand(dataSource, rootIds, "in", "film_actor", 300); - assertEquals(data.getNodesClasses().size(), 1); - assertEquals(data.getNodes().size(), 4); - assertEquals(data.getEdgesClasses().size(), 1); - assertEquals(data.getEdges().size(), 4); + assertThat(data.getNodesClasses().size()).isEqualTo(1); + assertThat(data.getNodes().size()).isEqualTo(4); + assertThat(data.getEdgesClasses().size()).isEqualTo(1); + assertThat(data.getEdges().size()).isEqualTo(4); // Node classes checks - assertTrue(data.getNodesClasses().containsKey("actor")); + assertThat(data.getNodesClasses().containsKey("actor")).isTrue(); Map actorClass = data.getNodesClasses().get("actor"); - assertTrue(actorClass.containsKey("actor_id")); - assertTrue(actorClass.containsKey("first_name")); - assertTrue(actorClass.containsKey("last_name")); - assertTrue(actorClass.containsKey("last_update")); + assertThat(actorClass.containsKey("actor_id")).isTrue(); + assertThat(actorClass.containsKey("first_name")).isTrue(); + assertThat(actorClass.containsKey("last_name")).isTrue(); + assertThat(actorClass.containsKey("last_update")).isTrue(); // nodes checks it = data.getNodes().iterator(); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 19); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Bob"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Fawcett"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(19); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Bob"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Fawcett"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 85); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Minnie"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Zellweger"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(85); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Minnie"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Zellweger"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 90); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Sean"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Guiness"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(90); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Sean"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Guiness"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); currNodeContent = it.next(); - assertNotNull(currNodeContent.getData()); - assertNotNull(currNodeContent.getData().getRecord()); + assertThat(currNodeContent.getData()).isNotNull(); + assertThat(currNodeContent.getData().getRecord()).isNotNull(); currRecord = currNodeContent.getData().getRecord(); - assertTrue(currRecord.containsKey("actor_id")); - assertEquals(currRecord.get("actor_id"), 160); - assertTrue(currRecord.containsKey("first_name")); - assertEquals(currRecord.get("first_name"), "Chris"); - assertTrue(currRecord.containsKey("last_name")); - assertEquals(currRecord.get("last_name"), "Depp"); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currRecord.get("last_update").toString(), "2013-05-26 14:47:57.62"); + assertThat(currRecord.containsKey("actor_id")).isTrue(); + assertThat(currRecord.get("actor_id")).isEqualTo(160); + assertThat(currRecord.containsKey("first_name")).isTrue(); + assertThat(currRecord.get("first_name")).isEqualTo("Chris"); + assertThat(currRecord.containsKey("last_name")).isTrue(); + assertThat(currRecord.get("last_name")).isEqualTo("Depp"); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currRecord.get("last_update").toString()).isEqualTo("2013-05-26 14:47:57.62"); // edges checks it = data.getEdges().iterator(); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_19"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_19_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_19"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_19_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_85"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_85_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_85"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_85_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_90"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_90_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_90"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_90_2"); currEdgeContent = it.next(); - assertNotNull(currEdgeContent.getData()); - assertNotNull(currEdgeContent.getData().getRecord()); + assertThat(currEdgeContent.getData()).isNotNull(); + assertThat(currEdgeContent.getData().getRecord()).isNotNull(); currRecord = currEdgeContent.getData().getRecord(); - assertEquals(currRecord.size(), 1); - assertTrue(currRecord.containsKey("last_update")); - assertEquals(currEdgeContent.getClasses(), "film_actor"); - assertEquals(currEdgeContent.getGroup(), "edges"); - assertEquals(currEdgeContent.getData().getSource(), "1_160"); - assertEquals(currEdgeContent.getData().getTarget(), "7_2"); - assertEquals(currEdgeContent.getData().getId(), "8_160_2"); + assertThat(currRecord.size()).isEqualTo(1); + assertThat(currRecord.containsKey("last_update")).isTrue(); + assertThat(currEdgeContent.getClasses()).isEqualTo("film_actor"); + assertThat(currEdgeContent.getGroup()).isEqualTo("edges"); + assertThat(currEdgeContent.getData().getSource()).isEqualTo("1_160"); + assertThat(currEdgeContent.getData().getTarget()).isEqualTo("7_2"); + assertThat(currEdgeContent.getData().getId()).isEqualTo("8_160_2"); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/filter/FilterTableMappingTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/filter/FilterTableMappingTest.java index 4f33e37c..d9969466 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/filter/FilterTableMappingTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/filter/FilterTableMappingTest.java @@ -40,12 +40,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.context.Statistics; @@ -76,7 +72,7 @@ * @author Gabriele Ponzi */ -public class FilterTableMappingTest { +class FilterTableMappingTest { private static final String XML_TABLE_PER_CLASS = "src/test/resources/provider/rdbms/inheritance/hibernate/tablePerClassHierarchyImportTest.xml"; private static final String XML_TABLE_PER_SUBCLASS1 = "src/test/resources/provider/rdbms/inheritance/hibernate/tablePerSubclassImportTest1.xml"; @@ -96,7 +92,7 @@ public class FilterTableMappingTest { private Statistics statistics; @BeforeEach - public void init() { + void init() { this.dataSource = new DataSourceInfo( 1L, @@ -125,10 +121,10 @@ public void init() { statistics = new Statistics(); } - @Test /* * Filtering out a table through include-tables (without inheritance). - */public void filterOutThroughIncludeWithNoInheritance() { + */@Test + void filterOutThroughIncludeWithNoInheritance() { Connection connection = null; Statement st = null; @@ -185,15 +181,15 @@ public void init() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfEntities); - assertEquals(3, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(3); + assertThat(statistics.builtEntities).isEqualTo(3); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -205,106 +201,106 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(3, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(3); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(5, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", employeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", employeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(5, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(3, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", managerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(3, managerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(5); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(employeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(employeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(5); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(3); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(managerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(managerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(3); + assertThat(managerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("MANAGER"); // relationship, primary and foreign key check - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, managerEntity.getInCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); /* * Testing built graph model @@ -316,94 +312,94 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(employeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(5, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("salary")); - assertEquals("salary", employeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", employeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(5, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(3, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("project")); - assertEquals("project", managerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(3, managerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(5); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(employeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(employeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(5); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(3); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(managerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(3); + assertThat(managerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -411,82 +407,82 @@ public void init() { // Classes Mapping - assertEquals(3, mapper.getVertexType2EVClassMappers().size()); - assertEquals(3, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(3); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(3); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(5, employeeClassMapper.getAttribute2property().size()); - assertEquals(5, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("salary", employeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("SALARY", employeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(5); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(5); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(3, managerClassMapper.getAttribute2property().size()); - assertEquals(3, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("project", managerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - assertEquals("PROJECT", managerClassMapper.getProperty2attribute().get("project")); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(managerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator it = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -495,15 +491,15 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Filtering out a table through exclude-tables (without inheritance). - */public void filterOutThroughExcludeWithNoInheritance() { + */@Test + void filterOutThroughExcludeWithNoInheritance() { Connection connection = null; Statement st = null; @@ -559,15 +555,15 @@ public void init() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfEntities); - assertEquals(3, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(3); + assertThat(statistics.builtEntities).isEqualTo(3); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -579,104 +575,104 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(3, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(3); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(5, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", employeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", employeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(5, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(3, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", managerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(3, managerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(5); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(employeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(employeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(5); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(3); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(managerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(managerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(3); + assertThat(managerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("MANAGER"); // relationship, primary and foreign key check - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, managerEntity.getInCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); /* * Testing built graph model @@ -688,94 +684,94 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(employeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(5, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("salary")); - assertEquals("salary", employeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", employeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(5, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(3, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("project")); - assertEquals("project", managerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(3, managerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(5); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(employeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(employeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(5); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(3); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(managerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(3); + assertThat(managerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -783,82 +779,82 @@ public void init() { // Classes Mapping - assertEquals(3, mapper.getVertexType2EVClassMappers().size()); - assertEquals(3, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(3); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(3); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(5, employeeClassMapper.getAttribute2property().size()); - assertEquals(5, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("salary", employeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("SALARY", employeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(5); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(5); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(3, managerClassMapper.getAttribute2property().size()); - assertEquals(3, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("project", managerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - assertEquals("PROJECT", managerClassMapper.getProperty2attribute().get("project")); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(managerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator it = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -867,15 +863,15 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Filtering out a table through include-tables (with Table per Hierarchy inheritance). - */public void filterOutThroughIncludeWithTablePerHierarchyInheritance() { + */@Test + void filterOutThroughIncludeWithTablePerHierarchyInheritance() { Connection connection = null; Statement st = null; @@ -945,15 +941,15 @@ public void init() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfEntities); - assertEquals(3, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(3); + assertThat(statistics.builtEntities).isEqualTo(3); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(6, statistics.totalNumberOfModelVertices); - assertEquals(6, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(6); + assertThat(statistics.builtModelVertexTypes).isEqualTo(6); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -968,315 +964,315 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(6, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(6); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(4, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("Regular_Employee", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("Regular_Employee", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("Contract_Employee", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("Contract_Employee", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(2, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(1, projectManagerEntity.getAttributes().size()); - - assertNotNull(projectManagerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", projectManagerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", projectManagerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(1, projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("Project_Manager", projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(4); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("Regular_Employee"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("Regular_Employee"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("Contract_Employee"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("Contract_Employee"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(2); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getAttributes().size()).isEqualTo(1); + + assertThat(projectManagerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("Project_Manager"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(4, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(4, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, projectManagerEntity.getInheritedAttributes().size()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", projectManagerEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", projectManagerEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(0, countryEntity.getInheritedAttributes().size()); - assertEquals(0, managerEntity.getInheritedAttributes().size()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(projectManagerEntity.getInheritedAttributes().size()).isEqualTo(2); + + assertThat(projectManagerEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(countryEntity.getInheritedAttributes().size()).isEqualTo(0); + assertThat(managerEntity.getInheritedAttributes().size()).isEqualTo(0); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); - assertEquals(1, projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("MANAGER", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("MANAGER"); // relationship, primary and foreign key check - assertEquals(0, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, countryEntity.getInCanonicalRelationships().size()); - assertEquals(1, managerEntity.getInCanonicalRelationships().size()); - - assertEquals(0, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(0, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, countryEntity.getForeignKeys().size()); - assertEquals(0, managerEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(countryEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(1); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(countryEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(managerEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); Iterator itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); Iterator itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("MANAGER", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("MANAGER", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(managerEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(2, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(2); HierarchicalBag hierarchicalBag1 = mapper.getDataBaseSchema().getHierarchicalBags().get(0); HierarchicalBag hierarchicalBag2 = mapper.getDataBaseSchema().getHierarchicalBags().get(1); - assertEquals("table-per-hierarchy", hierarchicalBag1.getInheritancePattern()); - assertEquals("table-per-hierarchy", hierarchicalBag2.getInheritancePattern()); + assertThat(hierarchicalBag1.getInheritancePattern()).isEqualTo("table-per-hierarchy"); + assertThat(hierarchicalBag2.getInheritancePattern()).isEqualTo("table-per-hierarchy"); - assertEquals(2, hierarchicalBag1.getDepth2entities().size()); + assertThat(hierarchicalBag1.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag1.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag1.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag1.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag1.getDepth2entities().get(1).iterator(); - assertEquals("Regular_Employee", it.next().getName()); - assertEquals("Contract_Employee", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("Regular_Employee"); + assertThat(it.next().getName()).isEqualTo("Contract_Employee"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag1, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); - assertNotNull(hierarchicalBag1.getDiscriminatorColumn()); - assertEquals("TYPE", hierarchicalBag1.getDiscriminatorColumn()); + assertThat(hierarchicalBag1.getDiscriminatorColumn()).isNotNull(); + assertThat(hierarchicalBag1.getDiscriminatorColumn()).isEqualTo("TYPE"); - assertEquals(3, hierarchicalBag1.getEntityName2discriminatorValue().size()); - assertEquals("emp", hierarchicalBag1.getEntityName2discriminatorValue().get("EMPLOYEE")); - assertEquals("reg_emp", hierarchicalBag1.getEntityName2discriminatorValue().get("Regular_Employee")); - assertEquals("cont_emp", hierarchicalBag1.getEntityName2discriminatorValue().get("Contract_Employee")); + assertThat(hierarchicalBag1.getEntityName2discriminatorValue().size()).isEqualTo(3); + assertThat(hierarchicalBag1.getEntityName2discriminatorValue().get("EMPLOYEE")).isEqualTo("emp"); + assertThat(hierarchicalBag1.getEntityName2discriminatorValue().get("Regular_Employee")).isEqualTo("reg_emp"); + assertThat(hierarchicalBag1.getEntityName2discriminatorValue().get("Contract_Employee")).isEqualTo("cont_emp"); - assertEquals(2, hierarchicalBag2.getDepth2entities().size()); + assertThat(hierarchicalBag2.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(0).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(0).iterator(); - assertEquals("MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(1).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(1).iterator(); - assertEquals("Project_Manager", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("Project_Manager"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag2, managerEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag2, projectManagerEntity.getHierarchicalBag()); + assertThat(managerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); + assertThat(projectManagerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); - assertNotNull(hierarchicalBag2.getDiscriminatorColumn()); - assertEquals("TYPE", hierarchicalBag2.getDiscriminatorColumn()); + assertThat(hierarchicalBag2.getDiscriminatorColumn()).isNotNull(); + assertThat(hierarchicalBag2.getDiscriminatorColumn()).isEqualTo("TYPE"); - assertEquals(2, hierarchicalBag2.getEntityName2discriminatorValue().size()); - assertEquals("mgr", hierarchicalBag2.getEntityName2discriminatorValue().get("MANAGER")); - assertEquals("prj_mgr", hierarchicalBag2.getEntityName2discriminatorValue().get("Project_Manager")); + assertThat(hierarchicalBag2.getEntityName2discriminatorValue().size()).isEqualTo(2); + assertThat(hierarchicalBag2.getEntityName2discriminatorValue().get("MANAGER")).isEqualTo("mgr"); + assertThat(hierarchicalBag2.getEntityName2discriminatorValue().get("Project_Manager")).isEqualTo("prj_mgr"); /* * Testing built graph model @@ -1291,199 +1287,199 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(6, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNotNull(projectManagerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(6); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(projectManagerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(4, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(2, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertEquals(1, projectManagerVertexType.getProperties().size()); - - assertNotNull(projectManagerVertexType.getPropertyByName("project")); - assertEquals("project", projectManagerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(1, projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(4); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(2); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getProperties().size()).isEqualTo(1); + + assertThat(projectManagerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(projectManagerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(4, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(4, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, projectManagerVertexType.getInheritedProperties().size()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("id")); - assertEquals("id", projectManagerVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("name")); - assertEquals("name", projectManagerVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertEquals(0, countryVertexType.getInheritedProperties().size()); - assertEquals(0, managerVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedProperties().size()).isEqualTo(2); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getInheritedProperties().size()).isEqualTo(0); + assertThat(managerVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -1491,118 +1487,118 @@ public void init() { // Classes Mapping - assertEquals(6, mapper.getVertexType2EVClassMappers().size()); - assertEquals(6, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(6); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(6); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(4, employeeClassMapper.getAttribute2property().size()); - assertEquals(4, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()).isEqualTo(1); EVClassMapper regularEmployeeClassMapper = mapper.getEVClassMappersByVertex(regularEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()); - assertEquals(regularEmployeeClassMapper, mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)); - assertEquals(regularEmployeeClassMapper.getEntity(), regularEmployeeEntity); - assertEquals(regularEmployeeClassMapper.getVertexType(), regularEmployeeVertexType); - - assertEquals(2, regularEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, regularEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("salary", regularEmployeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("bonus", regularEmployeeClassMapper.getAttribute2property().get("BONUS")); - assertEquals("SALARY", regularEmployeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("BONUS", regularEmployeeClassMapper.getProperty2attribute().get("bonus")); - - assertEquals(1, mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)).isEqualTo(regularEmployeeClassMapper); + assertThat(regularEmployeeEntity).isEqualTo(regularEmployeeClassMapper.getEntity()); + assertThat(regularEmployeeVertexType).isEqualTo(regularEmployeeClassMapper.getVertexType()); + + assertThat(regularEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("BONUS")).isEqualTo("bonus"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("bonus")).isEqualTo("BONUS"); + + assertThat(mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()).isEqualTo(1); EVClassMapper contractEmployeeClassMapper = mapper.getEVClassMappersByVertex(contractEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()); - assertEquals(contractEmployeeClassMapper, mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)); - assertEquals(contractEmployeeClassMapper.getEntity(), contractEmployeeEntity); - assertEquals(contractEmployeeClassMapper.getVertexType(), contractEmployeeVertexType); - - assertEquals(2, contractEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, contractEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("payPerHour", contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")); - assertEquals("contractDuration", contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")); - assertEquals("PAY_PER_HOUR", contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")); - assertEquals("CONTRACT_DURATION", contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)).isEqualTo(contractEmployeeClassMapper); + assertThat(contractEmployeeEntity).isEqualTo(contractEmployeeClassMapper.getEntity()); + assertThat(contractEmployeeVertexType).isEqualTo(contractEmployeeClassMapper.getVertexType()); + + assertThat(contractEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")).isEqualTo("payPerHour"); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")).isEqualTo("contractDuration"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")).isEqualTo("CONTRACT_DURATION"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(2, managerClassMapper.getAttribute2property().size()); - assertEquals(2, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - - assertEquals(1, mapper.getEVClassMappersByVertex(projectManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + + assertThat(mapper.getEVClassMappersByVertex(projectManagerVertexType).size()).isEqualTo(1); EVClassMapper projectManagerClassMapper = mapper.getEVClassMappersByVertex(projectManagerVertexType).get(0); - assertEquals(projectManagerClassMapper, mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)); - assertEquals(projectManagerClassMapper.getEntity(), projectManagerEntity); - assertEquals(projectManagerClassMapper.getVertexType(), projectManagerVertexType); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)).isEqualTo(projectManagerClassMapper); + assertThat(projectManagerEntity).isEqualTo(projectManagerClassMapper.getEntity()); + assertThat(projectManagerVertexType).isEqualTo(projectManagerClassMapper.getVertexType()); - assertEquals(1, projectManagerClassMapper.getAttribute2property().size()); - assertEquals(1, projectManagerClassMapper.getProperty2attribute().size()); - assertEquals("project", projectManagerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("PROJECT", projectManagerClassMapper.getProperty2attribute().get("project")); + assertThat(projectManagerClassMapper.getAttribute2property().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getProperty2attribute().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(projectManagerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator itRelationships = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = itRelationships.next(); - assertFalse(itRelationships.hasNext()); + assertThat(itRelationships.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1611,15 +1607,15 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Filtering out a table through include-tables (with Table per Type inheritance). - */public void filterOutThroughIncludeWithTablePerTypeInheritance() { + */@Test + void filterOutThroughIncludeWithTablePerTypeInheritance() { Connection connection = null; Statement st = null; @@ -1713,15 +1709,15 @@ public void init() { * Testing context information */ - assertEquals(6, statistics.totalNumberOfEntities); - assertEquals(6, statistics.builtEntities); - assertEquals(4, statistics.totalNumberOfRelationships); - assertEquals(4, statistics.builtRelationships); // 3 of these are hierarchical relationships + assertThat(statistics.totalNumberOfEntities).isEqualTo(6); + assertThat(statistics.builtEntities).isEqualTo(6); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(4); + assertThat(statistics.builtRelationships).isEqualTo(4); // 3 of these are hierarchical relationships - assertEquals(6, statistics.totalNumberOfModelVertices); - assertEquals(6, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(6); + assertThat(statistics.builtModelVertexTypes).isEqualTo(6); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -1736,318 +1732,318 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(6, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(4, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(6); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(4); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(4, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(2, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(1, projectManagerEntity.getAttributes().size()); - - assertNotNull(projectManagerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", projectManagerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", projectManagerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(1, projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(4); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(2); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getAttributes().size()).isEqualTo(1); + + assertThat(projectManagerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(4, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(4, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, projectManagerEntity.getInheritedAttributes().size()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", projectManagerEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", projectManagerEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(0, countryEntity.getInheritedAttributes().size()); - assertEquals(0, managerEntity.getInheritedAttributes().size()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(projectManagerEntity.getInheritedAttributes().size()).isEqualTo(2); + + assertThat(projectManagerEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(countryEntity.getInheritedAttributes().size()).isEqualTo(0); + assertThat(managerEntity.getInheritedAttributes().size()).isEqualTo(0); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); - assertEquals(1, projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // relationship, primary and foreign key check - assertEquals(1, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, projectManagerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(2, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, projectManagerEntity.getInCanonicalRelationships().size()); - assertEquals(2, managerEntity.getInCanonicalRelationships().size()); - assertEquals(0, countryEntity.getInCanonicalRelationships().size()); - - assertEquals(1, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(1, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(1, projectManagerEntity.getForeignKeys().size()); - assertEquals(0, managerEntity.getForeignKeys().size()); - assertEquals(0, countryEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(projectManagerEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(projectManagerEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(countryEntity.getInCanonicalRelationships().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(projectManagerEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(managerEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(countryEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); Iterator itContEmp = contractEmployeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentContEmpRel = itContEmp.next(); itEmp = employeeEntity.getInCanonicalRelationships().iterator(); currentEmpRel = itEmp.next(); - assertEquals(currentContEmpRel, currentEmpRel); + assertThat(currentEmpRel).isEqualTo(currentContEmpRel); Iterator itRegEmp = regularEmployeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); currentEmpRel = itEmp.next(); - assertEquals(currentRegEmpRel, currentEmpRel); + assertThat(currentEmpRel).isEqualTo(currentRegEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); currentRegEmpRel = itRegEmp.next(); currentContEmpRel = itContEmp.next(); - assertEquals("MANAGER", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("MANAGER", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(managerEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(2, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(2); HierarchicalBag hierarchicalBag1 = mapper.getDataBaseSchema().getHierarchicalBags().get(0); HierarchicalBag hierarchicalBag2 = mapper.getDataBaseSchema().getHierarchicalBags().get(1); - assertEquals("table-per-type", hierarchicalBag1.getInheritancePattern()); - assertEquals("table-per-type", hierarchicalBag2.getInheritancePattern()); + assertThat(hierarchicalBag1.getInheritancePattern()).isEqualTo("table-per-type"); + assertThat(hierarchicalBag2.getInheritancePattern()).isEqualTo("table-per-type"); - assertEquals(2, hierarchicalBag1.getDepth2entities().size()); + assertThat(hierarchicalBag1.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag1.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag1.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag1.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag1.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag1, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); - assertNull(hierarchicalBag1.getDiscriminatorColumn()); + assertThat(hierarchicalBag1.getDiscriminatorColumn()).isNull(); - assertEquals(2, hierarchicalBag2.getDepth2entities().size()); + assertThat(hierarchicalBag2.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(0).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(0).iterator(); - assertEquals("MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(1).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(1).iterator(); - assertEquals("PROJECT_MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("PROJECT_MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag2, managerEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag2, projectManagerEntity.getHierarchicalBag()); + assertThat(managerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); + assertThat(projectManagerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); - assertNull(hierarchicalBag2.getDiscriminatorColumn()); + assertThat(hierarchicalBag2.getDiscriminatorColumn()).isNull(); /* * Testing built graph model @@ -2062,199 +2058,199 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(6, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNotNull(projectManagerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(6); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(projectManagerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(4, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(2, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertEquals(1, projectManagerVertexType.getProperties().size()); - - assertNotNull(projectManagerVertexType.getPropertyByName("project")); - assertEquals("project", projectManagerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(1, projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(4); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(2); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getProperties().size()).isEqualTo(1); + + assertThat(projectManagerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(projectManagerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(4, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(4, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, projectManagerVertexType.getInheritedProperties().size()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("id")); - assertEquals("id", projectManagerVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("name")); - assertEquals("name", projectManagerVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertEquals(0, countryVertexType.getInheritedProperties().size()); - assertEquals(0, managerVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedProperties().size()).isEqualTo(2); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getInheritedProperties().size()).isEqualTo(0); + assertThat(managerVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -2262,118 +2258,118 @@ public void init() { // Classes Mapping - assertEquals(6, mapper.getVertexType2EVClassMappers().size()); - assertEquals(6, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(6); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(6); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(4, employeeClassMapper.getAttribute2property().size()); - assertEquals(4, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()).isEqualTo(1); EVClassMapper regularEmployeeClassMapper = mapper.getEVClassMappersByVertex(regularEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()); - assertEquals(regularEmployeeClassMapper, mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)); - assertEquals(regularEmployeeClassMapper.getEntity(), regularEmployeeEntity); - assertEquals(regularEmployeeClassMapper.getVertexType(), regularEmployeeVertexType); - - assertEquals(2, regularEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, regularEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("salary", regularEmployeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("bonus", regularEmployeeClassMapper.getAttribute2property().get("BONUS")); - assertEquals("SALARY", regularEmployeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("BONUS", regularEmployeeClassMapper.getProperty2attribute().get("bonus")); - - assertEquals(1, mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)).isEqualTo(regularEmployeeClassMapper); + assertThat(regularEmployeeEntity).isEqualTo(regularEmployeeClassMapper.getEntity()); + assertThat(regularEmployeeVertexType).isEqualTo(regularEmployeeClassMapper.getVertexType()); + + assertThat(regularEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("BONUS")).isEqualTo("bonus"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("bonus")).isEqualTo("BONUS"); + + assertThat(mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()).isEqualTo(1); EVClassMapper contractEmployeeClassMapper = mapper.getEVClassMappersByVertex(contractEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()); - assertEquals(contractEmployeeClassMapper, mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)); - assertEquals(contractEmployeeClassMapper.getEntity(), contractEmployeeEntity); - assertEquals(contractEmployeeClassMapper.getVertexType(), contractEmployeeVertexType); - - assertEquals(2, contractEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, contractEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("payPerHour", contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")); - assertEquals("contractDuration", contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")); - assertEquals("PAY_PER_HOUR", contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")); - assertEquals("CONTRACT_DURATION", contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)).isEqualTo(contractEmployeeClassMapper); + assertThat(contractEmployeeEntity).isEqualTo(contractEmployeeClassMapper.getEntity()); + assertThat(contractEmployeeVertexType).isEqualTo(contractEmployeeClassMapper.getVertexType()); + + assertThat(contractEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")).isEqualTo("payPerHour"); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")).isEqualTo("contractDuration"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")).isEqualTo("CONTRACT_DURATION"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(2, managerClassMapper.getAttribute2property().size()); - assertEquals(2, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - - assertEquals(1, mapper.getEVClassMappersByVertex(projectManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + + assertThat(mapper.getEVClassMappersByVertex(projectManagerVertexType).size()).isEqualTo(1); EVClassMapper projectManagerClassMapper = mapper.getEVClassMappersByVertex(projectManagerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(projectManagerEntity).size()); - assertEquals(projectManagerClassMapper, mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)); - assertEquals(projectManagerClassMapper.getEntity(), projectManagerEntity); - assertEquals(projectManagerClassMapper.getVertexType(), projectManagerVertexType); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)).isEqualTo(projectManagerClassMapper); + assertThat(projectManagerEntity).isEqualTo(projectManagerClassMapper.getEntity()); + assertThat(projectManagerVertexType).isEqualTo(projectManagerClassMapper.getVertexType()); - assertEquals(1, projectManagerClassMapper.getAttribute2property().size()); - assertEquals(1, projectManagerClassMapper.getProperty2attribute().size()); - assertEquals("project", projectManagerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("PROJECT", projectManagerClassMapper.getProperty2attribute().get("project")); + assertThat(projectManagerClassMapper.getAttribute2property().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getProperty2attribute().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(projectManagerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator itRelationships = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = itRelationships.next(); - assertFalse(itRelationships.hasNext()); + assertThat(itRelationships.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -2382,15 +2378,15 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Filtering out a table through exclude-tables (with Table per Type inheritance). - */public void filterOutThroughExcludeWithTablePerTypeInheritance() { + */@Test + void filterOutThroughExcludeWithTablePerTypeInheritance() { Connection connection = null; Statement st = null; @@ -2480,15 +2476,15 @@ public void init() { * Testing context information */ - assertEquals(6, statistics.totalNumberOfEntities); - assertEquals(6, statistics.builtEntities); - assertEquals(4, statistics.totalNumberOfRelationships); - assertEquals(4, statistics.builtRelationships); // 3 of these are hierarchical relationships + assertThat(statistics.totalNumberOfEntities).isEqualTo(6); + assertThat(statistics.builtEntities).isEqualTo(6); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(4); + assertThat(statistics.builtRelationships).isEqualTo(4); // 3 of these are hierarchical relationships - assertEquals(6, statistics.totalNumberOfModelVertices); - assertEquals(6, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(6); + assertThat(statistics.builtModelVertexTypes).isEqualTo(6); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -2503,318 +2499,318 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(6, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(4, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(6); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(4); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(4, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(2, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(1, projectManagerEntity.getAttributes().size()); - - assertNotNull(projectManagerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", projectManagerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", projectManagerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(1, projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(4); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(2); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getAttributes().size()).isEqualTo(1); + + assertThat(projectManagerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(4, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(4, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, projectManagerEntity.getInheritedAttributes().size()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", projectManagerEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", projectManagerEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(0, countryEntity.getInheritedAttributes().size()); - assertEquals(0, managerEntity.getInheritedAttributes().size()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(projectManagerEntity.getInheritedAttributes().size()).isEqualTo(2); + + assertThat(projectManagerEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(countryEntity.getInheritedAttributes().size()).isEqualTo(0); + assertThat(managerEntity.getInheritedAttributes().size()).isEqualTo(0); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); - assertEquals(1, projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // relationship, primary and foreign key check - assertEquals(1, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, projectManagerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(2, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, projectManagerEntity.getInCanonicalRelationships().size()); - assertEquals(2, managerEntity.getInCanonicalRelationships().size()); - assertEquals(0, countryEntity.getInCanonicalRelationships().size()); - - assertEquals(1, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(1, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(1, projectManagerEntity.getForeignKeys().size()); - assertEquals(0, managerEntity.getForeignKeys().size()); - assertEquals(0, countryEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(projectManagerEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(projectManagerEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(countryEntity.getInCanonicalRelationships().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(projectManagerEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(managerEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(countryEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); Iterator itContEmp = contractEmployeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentContEmpRel = itContEmp.next(); itEmp = employeeEntity.getInCanonicalRelationships().iterator(); currentEmpRel = itEmp.next(); - assertEquals(currentContEmpRel, currentEmpRel); + assertThat(currentEmpRel).isEqualTo(currentContEmpRel); Iterator itRegEmp = regularEmployeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); currentEmpRel = itEmp.next(); - assertEquals(currentRegEmpRel, currentEmpRel); + assertThat(currentEmpRel).isEqualTo(currentRegEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); currentRegEmpRel = itRegEmp.next(); currentContEmpRel = itContEmp.next(); - assertEquals("MANAGER", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("MANAGER", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(managerEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(2, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(2); HierarchicalBag hierarchicalBag1 = mapper.getDataBaseSchema().getHierarchicalBags().get(0); HierarchicalBag hierarchicalBag2 = mapper.getDataBaseSchema().getHierarchicalBags().get(1); - assertEquals("table-per-type", hierarchicalBag1.getInheritancePattern()); - assertEquals("table-per-type", hierarchicalBag2.getInheritancePattern()); + assertThat(hierarchicalBag1.getInheritancePattern()).isEqualTo("table-per-type"); + assertThat(hierarchicalBag2.getInheritancePattern()).isEqualTo("table-per-type"); - assertEquals(2, hierarchicalBag1.getDepth2entities().size()); + assertThat(hierarchicalBag1.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag1.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag1.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag1.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag1.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag1, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); - assertNotNull(hierarchicalBag1.getDiscriminatorColumn()); + assertThat(hierarchicalBag1.getDiscriminatorColumn()).isNotNull(); - assertEquals(2, hierarchicalBag2.getDepth2entities().size()); + assertThat(hierarchicalBag2.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(0).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(0).iterator(); - assertEquals("MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(1).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(1).iterator(); - assertEquals("PROJECT_MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("PROJECT_MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag2, managerEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag2, projectManagerEntity.getHierarchicalBag()); + assertThat(managerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); + assertThat(projectManagerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); - assertNotNull(hierarchicalBag2.getDiscriminatorColumn()); + assertThat(hierarchicalBag2.getDiscriminatorColumn()).isNotNull(); /* * Testing built graph model @@ -2829,199 +2825,199 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(6, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNotNull(projectManagerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(6); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(projectManagerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(4, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(2, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertEquals(1, projectManagerVertexType.getProperties().size()); - - assertNotNull(projectManagerVertexType.getPropertyByName("project")); - assertEquals("project", projectManagerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(1, projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(4); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(2); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getProperties().size()).isEqualTo(1); + + assertThat(projectManagerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(projectManagerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(4, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(4, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, projectManagerVertexType.getInheritedProperties().size()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("id")); - assertEquals("id", projectManagerVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("name")); - assertEquals("name", projectManagerVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertEquals(0, countryVertexType.getInheritedProperties().size()); - assertEquals(0, managerVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedProperties().size()).isEqualTo(2); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getInheritedProperties().size()).isEqualTo(0); + assertThat(managerVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -3029,118 +3025,118 @@ public void init() { // Classes Mapping - assertEquals(6, mapper.getVertexType2EVClassMappers().size()); - assertEquals(6, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(6); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(6); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(4, employeeClassMapper.getAttribute2property().size()); - assertEquals(4, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()).isEqualTo(1); EVClassMapper regularEmployeeClassMapper = mapper.getEVClassMappersByVertex(regularEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()); - assertEquals(regularEmployeeClassMapper, mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)); - assertEquals(regularEmployeeClassMapper.getEntity(), regularEmployeeEntity); - assertEquals(regularEmployeeClassMapper.getVertexType(), regularEmployeeVertexType); - - assertEquals(2, regularEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, regularEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("salary", regularEmployeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("bonus", regularEmployeeClassMapper.getAttribute2property().get("BONUS")); - assertEquals("SALARY", regularEmployeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("BONUS", regularEmployeeClassMapper.getProperty2attribute().get("bonus")); - - assertEquals(1, mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)).isEqualTo(regularEmployeeClassMapper); + assertThat(regularEmployeeEntity).isEqualTo(regularEmployeeClassMapper.getEntity()); + assertThat(regularEmployeeVertexType).isEqualTo(regularEmployeeClassMapper.getVertexType()); + + assertThat(regularEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("BONUS")).isEqualTo("bonus"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("bonus")).isEqualTo("BONUS"); + + assertThat(mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()).isEqualTo(1); EVClassMapper contractEmployeeClassMapper = mapper.getEVClassMappersByVertex(contractEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()); - assertEquals(contractEmployeeClassMapper, mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)); - assertEquals(contractEmployeeClassMapper.getEntity(), contractEmployeeEntity); - assertEquals(contractEmployeeClassMapper.getVertexType(), contractEmployeeVertexType); - - assertEquals(2, contractEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, contractEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("payPerHour", contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")); - assertEquals("contractDuration", contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")); - assertEquals("PAY_PER_HOUR", contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")); - assertEquals("CONTRACT_DURATION", contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)).isEqualTo(contractEmployeeClassMapper); + assertThat(contractEmployeeEntity).isEqualTo(contractEmployeeClassMapper.getEntity()); + assertThat(contractEmployeeVertexType).isEqualTo(contractEmployeeClassMapper.getVertexType()); + + assertThat(contractEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")).isEqualTo("payPerHour"); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")).isEqualTo("contractDuration"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")).isEqualTo("CONTRACT_DURATION"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(2, managerClassMapper.getAttribute2property().size()); - assertEquals(2, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - - assertEquals(1, mapper.getEVClassMappersByVertex(projectManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + + assertThat(mapper.getEVClassMappersByVertex(projectManagerVertexType).size()).isEqualTo(1); EVClassMapper projectManagerClassMapper = mapper.getEVClassMappersByVertex(projectManagerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(projectManagerEntity).size()); - assertEquals(projectManagerClassMapper, mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)); - assertEquals(projectManagerClassMapper.getEntity(), projectManagerEntity); - assertEquals(projectManagerClassMapper.getVertexType(), projectManagerVertexType); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)).isEqualTo(projectManagerClassMapper); + assertThat(projectManagerEntity).isEqualTo(projectManagerClassMapper.getEntity()); + assertThat(projectManagerVertexType).isEqualTo(projectManagerClassMapper.getVertexType()); - assertEquals(1, projectManagerClassMapper.getAttribute2property().size()); - assertEquals(1, projectManagerClassMapper.getProperty2attribute().size()); - assertEquals("project", projectManagerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("PROJECT", projectManagerClassMapper.getProperty2attribute().get("project")); + assertThat(projectManagerClassMapper.getAttribute2property().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getProperty2attribute().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(projectManagerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator itRelationships = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = itRelationships.next(); - assertFalse(itRelationships.hasNext()); + assertThat(itRelationships.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -3149,15 +3145,15 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Filtering out a table through include-tables (with Table per Concrete Type inheritance). - */public void filterOutThroughIncludeWithTablePerConcreteTypeInheritance() { + */@Test + void filterOutThroughIncludeWithTablePerConcreteTypeInheritance() { Connection connection = null; Statement st = null; @@ -3256,15 +3252,15 @@ public void init() { * Testing context information */ - assertEquals(6, statistics.totalNumberOfEntities); - assertEquals(6, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(6); + assertThat(statistics.builtEntities).isEqualTo(6); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(6, statistics.totalNumberOfModelVertices); - assertEquals(6, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(6); + assertThat(statistics.builtModelVertexTypes).isEqualTo(6); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -3279,307 +3275,307 @@ public void init() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(6, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(countryEntity); - assertNotNull(managerEntity); - assertNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(6); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(countryEntity).isNotNull(); + assertThat(managerEntity).isNotNull(); + assertThat(residenceEntity).isNull(); // attributes check - assertEquals(4, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("MANAGER")); - assertEquals("MANAGER", employeeEntity.getAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("MANAGER").getDataType()); - assertEquals(4, employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); - - assertEquals(3, countryEntity.getAttributes().size()); - - assertNotNull(countryEntity.getAttributeByName("ID")); - assertEquals("ID", countryEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, countryEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("NAME")); - assertEquals("NAME", countryEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, countryEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(countryEntity.getAttributeByName("CONTINENT")); - assertEquals("CONTINENT", countryEntity.getAttributeByName("CONTINENT").getName()); - assertEquals("VARCHAR", countryEntity.getAttributeByName("CONTINENT").getDataType()); - assertEquals(3, countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()); - assertEquals("COUNTRY", countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()); - - assertEquals(2, managerEntity.getAttributes().size()); - - assertNotNull(managerEntity.getAttributeByName("ID")); - assertEquals("ID", managerEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, managerEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(managerEntity.getAttributeByName("NAME")); - assertEquals("NAME", managerEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", managerEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, managerEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(1, projectManagerEntity.getAttributes().size()); - - assertNotNull(projectManagerEntity.getAttributeByName("PROJECT")); - assertEquals("PROJECT", projectManagerEntity.getAttributeByName("PROJECT").getName()); - assertEquals("VARCHAR", projectManagerEntity.getAttributeByName("PROJECT").getDataType()); - assertEquals(1, projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(4); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("MANAGER")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeEntity.getAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(countryEntity.getAttributes().size()).isEqualTo(3); + + assertThat(countryEntity.getAttributeByName("ID")).isNotNull(); + assertThat(countryEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(countryEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(countryEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(countryEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(countryEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(countryEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(countryEntity.getAttributeByName("CONTINENT")).isNotNull(); + assertThat(countryEntity.getAttributeByName("CONTINENT").getName()).isEqualTo("CONTINENT"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getDataType()).isEqualTo("VARCHAR"); + assertThat(countryEntity.getAttributeByName("CONTINENT").getOrdinalPosition()).isEqualTo(3); + assertThat(countryEntity.getAttributeByName("CONTINENT").getBelongingEntity().getName()).isEqualTo("COUNTRY"); + + assertThat(managerEntity.getAttributes().size()).isEqualTo(2); + + assertThat(managerEntity.getAttributeByName("ID")).isNotNull(); + assertThat(managerEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(managerEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(managerEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(managerEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(managerEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(managerEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(managerEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(managerEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getAttributes().size()).isEqualTo(1); + + assertThat(projectManagerEntity.getAttributeByName("PROJECT")).isNotNull(); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getName()).isEqualTo("PROJECT"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getAttributeByName("PROJECT").getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(4, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(4, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")); - assertEquals("MANAGER", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()); - assertEquals(4, contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()); - - assertEquals(2, projectManagerEntity.getInheritedAttributes().size()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", projectManagerEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(projectManagerEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", projectManagerEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("MANAGER", projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(0, countryEntity.getInheritedAttributes().size()); - assertEquals(0, managerEntity.getInheritedAttributes().size()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(4); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getName()).isEqualTo("MANAGER"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("MANAGER").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(projectManagerEntity.getInheritedAttributes().size()).isEqualTo(2); + + assertThat(projectManagerEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("MANAGER"); + + assertThat(countryEntity.getInheritedAttributes().size()).isEqualTo(0); + assertThat(managerEntity.getInheritedAttributes().size()).isEqualTo(0); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); - assertEquals(1, projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("PROJECT_MANAGER", projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(projectManagerEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("PROJECT_MANAGER"); // relationship, primary and foreign key check - assertEquals(0, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, projectManagerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, managerEntity.getOutCanonicalRelationships().size()); - assertEquals(0, countryEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, projectManagerEntity.getInCanonicalRelationships().size()); - assertEquals(1, managerEntity.getInCanonicalRelationships().size()); - assertEquals(0, countryEntity.getInCanonicalRelationships().size()); - - assertEquals(0, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(0, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, projectManagerEntity.getForeignKeys().size()); - assertEquals(0, managerEntity.getForeignKeys().size()); - assertEquals(0, countryEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(projectManagerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(countryEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(projectManagerEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(managerEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(countryEntity.getInCanonicalRelationships().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(projectManagerEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(managerEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(countryEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("MANAGER", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itManager = managerEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentManRel = itManager.next(); - assertEquals(currentEmpRel, currentManRel); + assertThat(currentManRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); Iterator itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); Iterator itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("MANAGER", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("MANAGER", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(managerEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(managerEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("MANAGER", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(managerEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("MANAGER"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(2, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(2); HierarchicalBag hierarchicalBag1 = mapper.getDataBaseSchema().getHierarchicalBags().get(0); HierarchicalBag hierarchicalBag2 = mapper.getDataBaseSchema().getHierarchicalBags().get(1); - assertEquals("table-per-concrete-type", hierarchicalBag1.getInheritancePattern()); - assertEquals("table-per-concrete-type", hierarchicalBag2.getInheritancePattern()); + assertThat(hierarchicalBag1.getInheritancePattern()).isEqualTo("table-per-concrete-type"); + assertThat(hierarchicalBag2.getInheritancePattern()).isEqualTo("table-per-concrete-type"); - assertEquals(2, hierarchicalBag1.getDepth2entities().size()); + assertThat(hierarchicalBag1.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag1.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag1.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag1.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag1.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag1.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag1, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag1, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag1); - assertNull(hierarchicalBag1.getDiscriminatorColumn()); + assertThat(hierarchicalBag1.getDiscriminatorColumn()).isNull(); - assertEquals(2, hierarchicalBag2.getDepth2entities().size()); + assertThat(hierarchicalBag2.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(0).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(0).iterator(); - assertEquals("MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, hierarchicalBag2.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag2.getDepth2entities().get(1).size()).isEqualTo(1); it = hierarchicalBag2.getDepth2entities().get(1).iterator(); - assertEquals("PROJECT_MANAGER", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("PROJECT_MANAGER"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag2, managerEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag2, projectManagerEntity.getHierarchicalBag()); + assertThat(managerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); + assertThat(projectManagerEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag2); - assertNull(hierarchicalBag2.getDiscriminatorColumn()); + assertThat(hierarchicalBag2.getDiscriminatorColumn()).isNull(); /* * Testing built graph model @@ -3594,199 +3590,199 @@ public void init() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(6, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(countryVertexType); - assertNotNull(managerVertexType); - assertNotNull(projectManagerVertexType); - assertNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(6); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(countryVertexType).isNotNull(); + assertThat(managerVertexType).isNotNull(); + assertThat(projectManagerVertexType).isNotNull(); + assertThat(residenceVertexType).isNull(); // properties check - assertEquals(4, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("manager")); - assertEquals("manager", employeeVertexType.getPropertyByName("manager").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("manager").getOriginalType()); - assertEquals(4, employeeVertexType.getPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, countryVertexType.getProperties().size()); - - assertNotNull(countryVertexType.getPropertyByName("id")); - assertEquals("id", countryVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, countryVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, countryVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("name")); - assertEquals("name", countryVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, countryVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(countryVertexType.getPropertyByName("continent")); - assertEquals("continent", countryVertexType.getPropertyByName("continent").getName()); - assertEquals("VARCHAR", countryVertexType.getPropertyByName("continent").getOriginalType()); - assertEquals(3, countryVertexType.getPropertyByName("continent").getOrdinalPosition()); - assertEquals(false, countryVertexType.getPropertyByName("continent").isFromPrimaryKey()); - - assertEquals(2, managerVertexType.getProperties().size()); - - assertNotNull(managerVertexType.getPropertyByName("id")); - assertEquals("id", managerVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, managerVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, managerVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(managerVertexType.getPropertyByName("name")); - assertEquals("name", managerVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", managerVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, managerVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, managerVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertEquals(1, projectManagerVertexType.getProperties().size()); - - assertNotNull(projectManagerVertexType.getPropertyByName("project")); - assertEquals("project", projectManagerVertexType.getPropertyByName("project").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getPropertyByName("project").getOriginalType()); - assertEquals(1, projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(4); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("manager")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(employeeVertexType.getPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(employeeVertexType.getPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getProperties().size()).isEqualTo(3); + + assertThat(countryVertexType.getPropertyByName("id")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(countryVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(countryVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(countryVertexType.getPropertyByName("name")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(countryVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(countryVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getPropertyByName("continent")).isNotNull(); + assertThat(countryVertexType.getPropertyByName("continent").getName()).isEqualTo("continent"); + assertThat(countryVertexType.getPropertyByName("continent").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(countryVertexType.getPropertyByName("continent").getOrdinalPosition()).isEqualTo(3); + assertThat(countryVertexType.getPropertyByName("continent").isFromPrimaryKey()).isFalse(); + + assertThat(managerVertexType.getProperties().size()).isEqualTo(2); + + assertThat(managerVertexType.getPropertyByName("id")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(managerVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(managerVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(managerVertexType.getPropertyByName("name")).isNotNull(); + assertThat(managerVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(managerVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(managerVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(managerVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getProperties().size()).isEqualTo(1); + + assertThat(projectManagerVertexType.getPropertyByName("project")).isNotNull(); + assertThat(projectManagerVertexType.getPropertyByName("project").getName()).isEqualTo("project"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getPropertyByName("project").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getPropertyByName("project").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(4, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(4, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("manager")); - assertEquals("manager", contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()); - assertEquals(4, contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()); - - assertEquals(2, projectManagerVertexType.getInheritedProperties().size()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("id")); - assertEquals("id", projectManagerVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(projectManagerVertexType.getInheritedPropertyByName("name")); - assertEquals("name", projectManagerVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertEquals(0, countryVertexType.getInheritedProperties().size()); - assertEquals(0, managerVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(4); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getName()).isEqualTo("manager"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").getOrdinalPosition()).isEqualTo(4); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("manager").isFromPrimaryKey()).isFalse(); + + assertThat(projectManagerVertexType.getInheritedProperties().size()).isEqualTo(2); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(projectManagerVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(projectManagerVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(projectManagerVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(countryVertexType.getInheritedProperties().size()).isEqualTo(0); + assertThat(managerVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasManager", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasManager", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasManager"); /* * Rules check @@ -3794,118 +3790,118 @@ public void init() { // Classes Mapping - assertEquals(6, mapper.getVertexType2EVClassMappers().size()); - assertEquals(6, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(6); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(6); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(4, employeeClassMapper.getAttribute2property().size()); - assertEquals(4, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("residence", employeeClassMapper.getAttribute2property().get("RESIDENCE")); - assertEquals("manager", employeeClassMapper.getAttribute2property().get("MANAGER")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); - assertEquals("RESIDENCE", employeeClassMapper.getProperty2attribute().get("residence")); - assertEquals("MANAGER", employeeClassMapper.getProperty2attribute().get("manager")); - - assertEquals(1, mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getAttribute2property().get("RESIDENCE")).isEqualTo("residence"); + assertThat(employeeClassMapper.getAttribute2property().get("MANAGER")).isEqualTo("manager"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("residence")).isEqualTo("RESIDENCE"); + assertThat(employeeClassMapper.getProperty2attribute().get("manager")).isEqualTo("MANAGER"); + + assertThat(mapper.getEVClassMappersByVertex(regularEmployeeVertexType).size()).isEqualTo(1); EVClassMapper regularEmployeeClassMapper = mapper.getEVClassMappersByVertex(regularEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()); - assertEquals(regularEmployeeClassMapper, mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)); - assertEquals(regularEmployeeClassMapper.getEntity(), regularEmployeeEntity); - assertEquals(regularEmployeeClassMapper.getVertexType(), regularEmployeeVertexType); - - assertEquals(2, regularEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, regularEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("salary", regularEmployeeClassMapper.getAttribute2property().get("SALARY")); - assertEquals("bonus", regularEmployeeClassMapper.getAttribute2property().get("BONUS")); - assertEquals("SALARY", regularEmployeeClassMapper.getProperty2attribute().get("salary")); - assertEquals("BONUS", regularEmployeeClassMapper.getProperty2attribute().get("bonus")); - - assertEquals(1, mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(regularEmployeeEntity).get(0)).isEqualTo(regularEmployeeClassMapper); + assertThat(regularEmployeeEntity).isEqualTo(regularEmployeeClassMapper.getEntity()); + assertThat(regularEmployeeVertexType).isEqualTo(regularEmployeeClassMapper.getVertexType()); + + assertThat(regularEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("SALARY")).isEqualTo("salary"); + assertThat(regularEmployeeClassMapper.getAttribute2property().get("BONUS")).isEqualTo("bonus"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("salary")).isEqualTo("SALARY"); + assertThat(regularEmployeeClassMapper.getProperty2attribute().get("bonus")).isEqualTo("BONUS"); + + assertThat(mapper.getEVClassMappersByVertex(contractEmployeeVertexType).size()).isEqualTo(1); EVClassMapper contractEmployeeClassMapper = mapper.getEVClassMappersByVertex(contractEmployeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()); - assertEquals(contractEmployeeClassMapper, mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)); - assertEquals(contractEmployeeClassMapper.getEntity(), contractEmployeeEntity); - assertEquals(contractEmployeeClassMapper.getVertexType(), contractEmployeeVertexType); - - assertEquals(2, contractEmployeeClassMapper.getAttribute2property().size()); - assertEquals(2, contractEmployeeClassMapper.getProperty2attribute().size()); - assertEquals("payPerHour", contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")); - assertEquals("contractDuration", contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")); - assertEquals("PAY_PER_HOUR", contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")); - assertEquals("CONTRACT_DURATION", contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")); - - assertEquals(1, mapper.getEVClassMappersByVertex(countryVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(contractEmployeeEntity).get(0)).isEqualTo(contractEmployeeClassMapper); + assertThat(contractEmployeeEntity).isEqualTo(contractEmployeeClassMapper.getEntity()); + assertThat(contractEmployeeVertexType).isEqualTo(contractEmployeeClassMapper.getVertexType()); + + assertThat(contractEmployeeClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("PAY_PER_HOUR")).isEqualTo("payPerHour"); + assertThat(contractEmployeeClassMapper.getAttribute2property().get("CONTRACT_DURATION")).isEqualTo("contractDuration"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("payPerHour")).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeClassMapper.getProperty2attribute().get("contractDuration")).isEqualTo("CONTRACT_DURATION"); + + assertThat(mapper.getEVClassMappersByVertex(countryVertexType).size()).isEqualTo(1); EVClassMapper countryClassMapper = mapper.getEVClassMappersByVertex(countryVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(countryEntity).size()); - assertEquals(countryClassMapper, mapper.getEVClassMappersByEntity(countryEntity).get(0)); - assertEquals(countryClassMapper.getEntity(), countryEntity); - assertEquals(countryClassMapper.getVertexType(), countryVertexType); - - assertEquals(3, countryClassMapper.getAttribute2property().size()); - assertEquals(3, countryClassMapper.getProperty2attribute().size()); - assertEquals("id", countryClassMapper.getAttribute2property().get("ID")); - assertEquals("name", countryClassMapper.getAttribute2property().get("NAME")); - assertEquals("continent", countryClassMapper.getAttribute2property().get("CONTINENT")); - assertEquals("ID", countryClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", countryClassMapper.getProperty2attribute().get("name")); - assertEquals("CONTINENT", countryClassMapper.getProperty2attribute().get("continent")); - - assertEquals(1, mapper.getEVClassMappersByVertex(managerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(countryEntity).get(0)).isEqualTo(countryClassMapper); + assertThat(countryEntity).isEqualTo(countryClassMapper.getEntity()); + assertThat(countryVertexType).isEqualTo(countryClassMapper.getVertexType()); + + assertThat(countryClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(countryClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(countryClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(countryClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(countryClassMapper.getAttribute2property().get("CONTINENT")).isEqualTo("continent"); + assertThat(countryClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(countryClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(countryClassMapper.getProperty2attribute().get("continent")).isEqualTo("CONTINENT"); + + assertThat(mapper.getEVClassMappersByVertex(managerVertexType).size()).isEqualTo(1); EVClassMapper managerClassMapper = mapper.getEVClassMappersByVertex(managerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(managerEntity).size()); - assertEquals(managerClassMapper, mapper.getEVClassMappersByEntity(managerEntity).get(0)); - assertEquals(managerClassMapper.getEntity(), managerEntity); - assertEquals(managerClassMapper.getVertexType(), managerVertexType); - - assertEquals(2, managerClassMapper.getAttribute2property().size()); - assertEquals(2, managerClassMapper.getProperty2attribute().size()); - assertEquals("id", managerClassMapper.getAttribute2property().get("ID")); - assertEquals("name", managerClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", managerClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", managerClassMapper.getProperty2attribute().get("name")); - - assertEquals(1, mapper.getEVClassMappersByVertex(projectManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(managerEntity).get(0)).isEqualTo(managerClassMapper); + assertThat(managerEntity).isEqualTo(managerClassMapper.getEntity()); + assertThat(managerVertexType).isEqualTo(managerClassMapper.getVertexType()); + + assertThat(managerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(managerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(managerClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(managerClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(managerClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(managerClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + + assertThat(mapper.getEVClassMappersByVertex(projectManagerVertexType).size()).isEqualTo(1); EVClassMapper projectManagerClassMapper = mapper.getEVClassMappersByVertex(projectManagerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(projectManagerEntity).size()); - assertEquals(projectManagerClassMapper, mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)); - assertEquals(projectManagerClassMapper.getEntity(), projectManagerEntity); - assertEquals(projectManagerClassMapper.getVertexType(), projectManagerVertexType); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(projectManagerEntity).get(0)).isEqualTo(projectManagerClassMapper); + assertThat(projectManagerEntity).isEqualTo(projectManagerClassMapper.getEntity()); + assertThat(projectManagerVertexType).isEqualTo(projectManagerClassMapper.getVertexType()); - assertEquals(1, projectManagerClassMapper.getAttribute2property().size()); - assertEquals(1, projectManagerClassMapper.getProperty2attribute().size()); - assertEquals("project", projectManagerClassMapper.getAttribute2property().get("PROJECT")); - assertEquals("PROJECT", projectManagerClassMapper.getProperty2attribute().get("project")); + assertThat(projectManagerClassMapper.getAttribute2property().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getProperty2attribute().size()).isEqualTo(1); + assertThat(projectManagerClassMapper.getAttribute2property().get("PROJECT")).isEqualTo("project"); + assertThat(projectManagerClassMapper.getProperty2attribute().get("project")).isEqualTo("PROJECT"); // Relationships-Edges Mapping Iterator itRelationships = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = itRelationships.next(); - assertFalse(itRelationships.hasNext()); + assertThat(itRelationships.hasNext()).isFalse(); EdgeType hasManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasManager"); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(hasManagerEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(hasManagerEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(hasManagerEdgeType).contains(hasManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -3914,7 +3910,7 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/AbstractRDBMSGraphProvider.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/AbstractRDBMSGraphProvider.java index a364362c..2eb409de 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/AbstractRDBMSGraphProvider.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/AbstractRDBMSGraphProvider.java @@ -20,7 +20,7 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.assertj.core.api.Assertions.assertThat; import com.arcadeanalytics.data.Sprite; import com.arcadeanalytics.data.SpritePlayer; @@ -51,7 +51,7 @@ public void begin() {} @Override public void play(Sprite document) { - assertNotNull(document.entries()); + assertThat(document.entries()).isNotNull(); processed++; if ( diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/MysqlGraphProviderTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/MysqlGraphProviderTest.java index b4763577..b6f2f6a3 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/MysqlGraphProviderTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/MysqlGraphProviderTest.java @@ -23,9 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat; import com.arcadeanalytics.provider.DataSourceInfo; -import com.arcadeanalytics.provider.rdbms.dataprovider.PostgreSQLDataProviderTest; import com.arcadeanalytics.provider.rdbms.dataprovider.RDBMSGraphProvider; -import org.junit.Assert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -35,7 +33,7 @@ public class MysqlGraphProviderTest extends AbstractRDBMSGraphProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(PostgreSQLDataProviderTest.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MysqlGraphProviderTest.class); private static final String driver = "com.mysql.cj.jdbc.Driver"; private static final String username = "test"; private static final String password = "test"; @@ -45,7 +43,7 @@ public class MysqlGraphProviderTest extends AbstractRDBMSGraphProvider { .withDatabaseName("sakila"); @BeforeAll - public static void beforeClass() throws Exception { + static void beforeClass() throws Exception { container.start(); container.withDatabaseName("sakila"); } @@ -79,8 +77,8 @@ public void shouldFetchAllVertexes() { assertThat(player.processed()).isEqualTo(47273); - Assert.assertEquals(47273, nodes); - Assert.assertEquals(0, edges); + assertThat(nodes).isEqualTo(47273); + assertThat(edges).isEqualTo(0); } @Test @@ -112,7 +110,7 @@ public void shouldFetchAllVertexesExceptJoinTables() { assertThat(player.processed()).isEqualTo(47273); - Assert.assertEquals(40811, nodes); - Assert.assertEquals(6462, edges); + assertThat(nodes).isEqualTo(40811); + assertThat(edges).isEqualTo(6462); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/PostgreSQLGraphProviderTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/PostgreSQLGraphProviderTest.java index 52961f99..e8d6dc4d 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/PostgreSQLGraphProviderTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/graphprovider/PostgreSQLGraphProviderTest.java @@ -1,5 +1,27 @@ package com.arcadeanalytics.provider.rdbms.graphprovider; +/*- + * #%L + * Arcade Connectors + * %% + * Copyright (C) 2018 - 2021 ArcadeData + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.assertj.core.api.Assertions.assertThat; + /*- * #%L * Arcade Connectors @@ -23,11 +45,10 @@ import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.dataprovider.PostgreSQLContainerHolder; import com.arcadeanalytics.provider.rdbms.dataprovider.RDBMSGraphProvider; -import org.junit.Assert; import org.junit.jupiter.api.Test; import org.testcontainers.containers.PostgreSQLContainer; -public class PostgreSQLGraphProviderTest extends AbstractRDBMSGraphProvider { +class PostgreSQLGraphProviderTest extends AbstractRDBMSGraphProvider { final PostgreSQLContainer container = PostgreSQLContainerHolder.container; @@ -57,10 +78,10 @@ public void shouldFetchAllVertexes() { provider = new RDBMSGraphProvider(); provider.provideTo(dataSource, player); - Assert.assertEquals(44820, player.processed()); + assertThat(player.processed()).isEqualTo(44820); - Assert.assertEquals(44820, nodes); - Assert.assertEquals(0, edges); + assertThat(nodes).isEqualTo(44820); + assertThat(edges).isEqualTo(0); } @Test @@ -89,9 +110,9 @@ public void shouldFetchAllVertexesExceptJoinTables() { provider = new RDBMSGraphProvider(); provider.provideTo(dataSource, player); - Assert.assertEquals(player.processed(), 44820); + assertThat(player.processed()).isEqualTo(44820); - Assert.assertEquals(38358, nodes); - Assert.assertEquals(6462, edges); + assertThat(nodes).isEqualTo(38358); + assertThat(edges).isEqualTo(6462); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/hibernate/HibernateMapperTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/hibernate/HibernateMapperTest.java index 1b293f90..59515899 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/hibernate/HibernateMapperTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/hibernate/HibernateMapperTest.java @@ -40,12 +40,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.context.Statistics; @@ -69,7 +65,7 @@ * @author Gabriele Ponzi */ -public class HibernateMapperTest { +class HibernateMapperTest { private static final String XML_TABLE_PER_CLASS = "src/test/resources/provider/rdbms/inheritance/hibernate/tablePerClassHierarchyInheritanceTest.xml"; private static final String XML_TABLE_PER_SUBCLASS1 = "src/test/resources/provider/rdbms/inheritance/hibernate/tablePerSubclassInheritanceTest1.xml"; @@ -89,7 +85,7 @@ public class HibernateMapperTest { private Statistics statistics; @BeforeEach - public void init() { + void init() { this.dataSource = new DataSourceInfo( 1L, @@ -118,13 +114,13 @@ public void init() { statistics = new Statistics(); } - @Test /* * Table per Class Hierarchy Inheritance ( tag) * table ( http://www.javatpoint.com/hibernate-table-per-hierarchy-example-using-xml-file ) */ - public void TablePerClassHierarchyInheritance() { + @Test + void TablePerClassHierarchyInheritance() { Connection connection = null; Statement st = null; @@ -163,15 +159,15 @@ public void TablePerClassHierarchyInheritance() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(4, statistics.totalNumberOfModelVertices); - assertEquals(4, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(4); + assertThat(statistics.builtModelVertexTypes).isEqualTo(4); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -183,206 +179,206 @@ public void TablePerClassHierarchyInheritance() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(4, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(4); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(residenceEntity).isNotNull(); // attributes check - assertEquals(3, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("Regular_Employee", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("Regular_Employee", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("Contract_Employee", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("Contract_Employee", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(3); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("Regular_Employee"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("Regular_Employee"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("Contract_Employee"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("Contract_Employee"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(3, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(3, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); // relationship, primary and foreign key check - assertEquals(0, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, residenceEntity.getInCanonicalRelationships().size()); - - assertEquals(0, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(0, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, residenceEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(residenceEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInCanonicalRelationships().size()).isEqualTo(1); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(residenceEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("RESIDENCE", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itRes = residenceEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentResRel = itRes.next(); - assertEquals(currentEmpRel, currentResRel); + assertThat(currentResRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); Iterator itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); Iterator itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("RESIDENCE", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); - assertNull(residenceEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); + assertThat(residenceEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); - assertEquals(0, residenceEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); + assertThat(residenceEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(1, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(1); HierarchicalBag hierarchicalBag = mapper.getDataBaseSchema().getHierarchicalBags().get(0); - assertEquals("table-per-hierarchy", hierarchicalBag.getInheritancePattern()); + assertThat(hierarchicalBag.getInheritancePattern()).isEqualTo("table-per-hierarchy"); - assertEquals(2, hierarchicalBag.getDepth2entities().size()); + assertThat(hierarchicalBag.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag.getDepth2entities().get(1).iterator(); - assertEquals("Regular_Employee", it.next().getName()); - assertEquals("Contract_Employee", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("Regular_Employee"); + assertThat(it.next().getName()).isEqualTo("Contract_Employee"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); - assertNotNull(hierarchicalBag.getDiscriminatorColumn()); - assertEquals("TYPE", hierarchicalBag.getDiscriminatorColumn()); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isNotNull(); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isEqualTo("TYPE"); - assertEquals(3, hierarchicalBag.getEntityName2discriminatorValue().size()); - assertEquals("emp", hierarchicalBag.getEntityName2discriminatorValue().get("EMPLOYEE")); - assertEquals("reg_emp", hierarchicalBag.getEntityName2discriminatorValue().get("Regular_Employee")); - assertEquals("cont_emp", hierarchicalBag.getEntityName2discriminatorValue().get("Contract_Employee")); + assertThat(hierarchicalBag.getEntityName2discriminatorValue().size()).isEqualTo(3); + assertThat(hierarchicalBag.getEntityName2discriminatorValue().get("EMPLOYEE")).isEqualTo("emp"); + assertThat(hierarchicalBag.getEntityName2discriminatorValue().get("Regular_Employee")).isEqualTo("reg_emp"); + assertThat(hierarchicalBag.getEntityName2discriminatorValue().get("Contract_Employee")).isEqualTo("cont_emp"); /* * Testing built graph model @@ -394,153 +390,153 @@ public void TablePerClassHierarchyInheritance() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(4, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(4); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(residenceVertexType).isNotNull(); // properties check - assertEquals(3, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, residenceVertexType.getProperties().size()); - - assertNotNull(residenceVertexType.getPropertyByName("id")); - assertEquals("id", residenceVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, residenceVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, residenceVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("city")); - assertEquals("city", residenceVertexType.getPropertyByName("city").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("city").getOriginalType()); - assertEquals(2, residenceVertexType.getPropertyByName("city").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("city").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("country")); - assertEquals("country", residenceVertexType.getPropertyByName("country").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("country").getOriginalType()); - assertEquals(3, residenceVertexType.getPropertyByName("country").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("country").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(3); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getProperties().size()).isEqualTo(3); + + assertThat(residenceVertexType.getPropertyByName("id")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(residenceVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(residenceVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(residenceVertexType.getPropertyByName("city")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("city").getName()).isEqualTo("city"); + assertThat(residenceVertexType.getPropertyByName("city").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("city").getOrdinalPosition()).isEqualTo(2); + assertThat(residenceVertexType.getPropertyByName("city").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getPropertyByName("country")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("country").getName()).isEqualTo("country"); + assertThat(residenceVertexType.getPropertyByName("country").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("country").getOrdinalPosition()).isEqualTo(3); + assertThat(residenceVertexType.getPropertyByName("country").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(3, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(3, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(0, residenceVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasResidence", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); // inheritance check - assertEquals(employeeVertexType, regularEmployeeVertexType.getParentType()); - assertEquals(employeeVertexType, contractEmployeeVertexType.getParentType()); - assertNull(employeeVertexType.getParentType()); + assertThat(regularEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(contractEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(employeeVertexType.getParentType()).isNull(); - assertEquals(1, regularEmployeeVertexType.getInheritanceLevel()); - assertEquals(1, contractEmployeeVertexType.getInheritanceLevel()); - assertEquals(0, employeeVertexType.getInheritanceLevel()); + assertThat(regularEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeVertexType.getInheritanceLevel()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -549,18 +545,18 @@ public void TablePerClassHierarchyInheritance() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Table per Subclass Inheritance ( tag) * 3 tables, one parent and 2 childs ( http://www.javatpoint.com/table-per-subclass ) */ - public void TablePerSubclassInheritanceSyntax1() { + @Test + void TablePerSubclassInheritanceSyntax1() { Connection connection = null; Statement st = null; @@ -607,15 +603,15 @@ public void TablePerSubclassInheritanceSyntax1() { * Testing context information */ - assertEquals(4, statistics.totalNumberOfEntities); - assertEquals(4, statistics.builtEntities); - assertEquals(3, statistics.totalNumberOfRelationships); - assertEquals(3, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(4); + assertThat(statistics.builtEntities).isEqualTo(4); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(3); + assertThat(statistics.builtRelationships).isEqualTo(3); - assertEquals(4, statistics.totalNumberOfModelVertices); - assertEquals(4, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(4); + assertThat(statistics.builtModelVertexTypes).isEqualTo(4); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -627,130 +623,130 @@ public void TablePerSubclassInheritanceSyntax1() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(4, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(3, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(4); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(3); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(residenceEntity).isNotNull(); // attributes check - assertEquals(3, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(3); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(3, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(3, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // relationship, primary and foreign key check - assertEquals(1, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(2, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, residenceEntity.getInCanonicalRelationships().size()); - - assertEquals(1, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(1, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, residenceEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(residenceEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(residenceEntity.getInCanonicalRelationships().size()).isEqualTo(1); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(residenceEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); Iterator itRegEmp = regularEmployeeEntity.getOutCanonicalRelationships().iterator(); @@ -758,93 +754,93 @@ public void TablePerSubclassInheritanceSyntax1() { CanonicalRelationship currentEmpRel = itEmp.next(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("REGULAR_EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getParentEntity().getName()); - assertEquals("CONTRACT_EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertEquals(employeeEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(regularEmployeeEntity.getForeignKeys().get(0), currentRegEmpRel.getForeignKey()); - assertEquals(employeeEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(contractEmployeeEntity.getForeignKeys().get(0), currentContEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(employeeEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getForeignKey()).isEqualTo(regularEmployeeEntity.getForeignKeys().get(0)); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(employeeEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getForeignKey()).isEqualTo(contractEmployeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); Iterator itRes = residenceEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentResRel = itRes.next(); - assertEquals(currentEmpRel, currentResRel); + assertThat(currentResRel).isEqualTo(currentEmpRel); itEmp = employeeEntity.getInCanonicalRelationships().iterator(); currentEmpRel = itEmp.next(); - assertEquals(currentEmpRel, currentContEmpRel); + assertThat(currentContEmpRel).isEqualTo(currentEmpRel); currentEmpRel = itEmp.next(); - assertEquals(currentEmpRel, currentRegEmpRel); + assertThat(currentRegEmpRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); currentRegEmpRel = itRegEmp.next(); currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("RESIDENCE", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); - - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentRegEmpRel.getFromColumns().get(0).getName()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); + + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); - assertNull(residenceEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); + assertThat(residenceEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); - assertEquals(0, residenceEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); + assertThat(residenceEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(1, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(1); HierarchicalBag hierarchicalBag = mapper.getDataBaseSchema().getHierarchicalBags().get(0); - assertEquals("table-per-type", hierarchicalBag.getInheritancePattern()); + assertThat(hierarchicalBag.getInheritancePattern()).isEqualTo("table-per-type"); - assertEquals(2, hierarchicalBag.getDepth2entities().size()); + assertThat(hierarchicalBag.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); - assertNull(hierarchicalBag.getDiscriminatorColumn()); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isNull(); /* * Testing built graph model @@ -856,153 +852,153 @@ public void TablePerSubclassInheritanceSyntax1() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(4, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(4); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(residenceVertexType).isNotNull(); // properties check - assertEquals(3, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, residenceVertexType.getProperties().size()); - - assertNotNull(residenceVertexType.getPropertyByName("id")); - assertEquals("id", residenceVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, residenceVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, residenceVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("city")); - assertEquals("city", residenceVertexType.getPropertyByName("city").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("city").getOriginalType()); - assertEquals(2, residenceVertexType.getPropertyByName("city").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("city").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("country")); - assertEquals("country", residenceVertexType.getPropertyByName("country").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("country").getOriginalType()); - assertEquals(3, residenceVertexType.getPropertyByName("country").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("country").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(3); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getProperties().size()).isEqualTo(3); + + assertThat(residenceVertexType.getPropertyByName("id")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(residenceVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(residenceVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(residenceVertexType.getPropertyByName("city")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("city").getName()).isEqualTo("city"); + assertThat(residenceVertexType.getPropertyByName("city").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("city").getOrdinalPosition()).isEqualTo(2); + assertThat(residenceVertexType.getPropertyByName("city").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getPropertyByName("country")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("country").getName()).isEqualTo("country"); + assertThat(residenceVertexType.getPropertyByName("country").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("country").getOrdinalPosition()).isEqualTo(3); + assertThat(residenceVertexType.getPropertyByName("country").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(3, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(3, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(0, residenceVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasResidence", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); // inheritance check - assertEquals(employeeVertexType, regularEmployeeVertexType.getParentType()); - assertEquals(employeeVertexType, contractEmployeeVertexType.getParentType()); - assertNull(employeeVertexType.getParentType()); + assertThat(regularEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(contractEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(employeeVertexType.getParentType()).isNull(); - assertEquals(1, regularEmployeeVertexType.getInheritanceLevel()); - assertEquals(1, contractEmployeeVertexType.getInheritanceLevel()); - assertEquals(0, employeeVertexType.getInheritanceLevel()); + assertThat(regularEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeVertexType.getInheritanceLevel()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1011,18 +1007,18 @@ public void TablePerSubclassInheritanceSyntax1() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Table per Subclass Inheritance ( tags) * 3 tables, one parent and 2 children ( http://www.javatpoint.com/table-per-subclass ) */ - public void TablePerSubclassInheritanceSyntax2() { + @Test + void TablePerSubclassInheritanceSyntax2() { Connection connection = null; Statement st = null; @@ -1069,15 +1065,15 @@ public void TablePerSubclassInheritanceSyntax2() { * Testing context information */ - assertEquals(4, statistics.totalNumberOfEntities); - assertEquals(4, statistics.builtEntities); - assertEquals(3, statistics.totalNumberOfRelationships); - assertEquals(3, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(4); + assertThat(statistics.builtEntities).isEqualTo(4); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(3); + assertThat(statistics.builtRelationships).isEqualTo(3); - assertEquals(4, statistics.totalNumberOfModelVertices); - assertEquals(4, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(4); + assertThat(statistics.builtModelVertexTypes).isEqualTo(4); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -1089,130 +1085,130 @@ public void TablePerSubclassInheritanceSyntax2() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(4, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(3, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(4); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(3); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(residenceEntity).isNotNull(); // attributes check - assertEquals(3, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(3); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(3, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(3, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); // primary key check - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("EID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // relationship, primary and foreign key check - assertEquals(1, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(2, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, residenceEntity.getInCanonicalRelationships().size()); - - assertEquals(1, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(1, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, residenceEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(residenceEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(residenceEntity.getInCanonicalRelationships().size()).isEqualTo(1); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(residenceEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); Iterator itRegEmp = regularEmployeeEntity.getOutCanonicalRelationships().iterator(); @@ -1220,91 +1216,91 @@ public void TablePerSubclassInheritanceSyntax2() { CanonicalRelationship currentEmpRel = itEmp.next(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("REGULAR_EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getParentEntity().getName()); - assertEquals("CONTRACT_EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertEquals(employeeEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(regularEmployeeEntity.getForeignKeys().get(0), currentRegEmpRel.getForeignKey()); - assertEquals(employeeEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(contractEmployeeEntity.getForeignKeys().get(0), currentContEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(employeeEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getForeignKey()).isEqualTo(regularEmployeeEntity.getForeignKeys().get(0)); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(employeeEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getForeignKey()).isEqualTo(contractEmployeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); Iterator itRes = residenceEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentResRel = itRes.next(); - assertEquals(currentEmpRel, currentResRel); + assertThat(currentResRel).isEqualTo(currentEmpRel); itEmp = employeeEntity.getInCanonicalRelationships().iterator(); currentEmpRel = itEmp.next(); - assertEquals(currentEmpRel, currentContEmpRel); + assertThat(currentContEmpRel).isEqualTo(currentEmpRel); currentEmpRel = itEmp.next(); - assertEquals(currentEmpRel, currentRegEmpRel); + assertThat(currentRegEmpRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); currentRegEmpRel = itRegEmp.next(); currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("RESIDENCE", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); - assertNull(residenceEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); + assertThat(residenceEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); - assertEquals(0, residenceEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); + assertThat(residenceEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(1, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(1); HierarchicalBag hierarchicalBag = mapper.getDataBaseSchema().getHierarchicalBags().get(0); - assertEquals("table-per-type", hierarchicalBag.getInheritancePattern()); + assertThat(hierarchicalBag.getInheritancePattern()).isEqualTo("table-per-type"); - assertEquals(2, hierarchicalBag.getDepth2entities().size()); + assertThat(hierarchicalBag.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); - assertNotNull(hierarchicalBag.getDiscriminatorColumn()); - assertEquals("employee_type", hierarchicalBag.getDiscriminatorColumn()); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isNotNull(); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isEqualTo("employee_type"); /* * Testing built graph model @@ -1316,153 +1312,153 @@ public void TablePerSubclassInheritanceSyntax2() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(4, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(4); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(residenceVertexType).isNotNull(); // properties check - assertEquals(3, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, residenceVertexType.getProperties().size()); - - assertNotNull(residenceVertexType.getPropertyByName("id")); - assertEquals("id", residenceVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, residenceVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, residenceVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("city")); - assertEquals("city", residenceVertexType.getPropertyByName("city").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("city").getOriginalType()); - assertEquals(2, residenceVertexType.getPropertyByName("city").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("city").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("country")); - assertEquals("country", residenceVertexType.getPropertyByName("country").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("country").getOriginalType()); - assertEquals(3, residenceVertexType.getPropertyByName("country").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("country").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(3); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getProperties().size()).isEqualTo(3); + + assertThat(residenceVertexType.getPropertyByName("id")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(residenceVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(residenceVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(residenceVertexType.getPropertyByName("city")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("city").getName()).isEqualTo("city"); + assertThat(residenceVertexType.getPropertyByName("city").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("city").getOrdinalPosition()).isEqualTo(2); + assertThat(residenceVertexType.getPropertyByName("city").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getPropertyByName("country")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("country").getName()).isEqualTo("country"); + assertThat(residenceVertexType.getPropertyByName("country").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("country").getOrdinalPosition()).isEqualTo(3); + assertThat(residenceVertexType.getPropertyByName("country").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(3, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(3, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(0, residenceVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasResidence", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); // inheritance check - assertEquals(employeeVertexType, regularEmployeeVertexType.getParentType()); - assertEquals(employeeVertexType, contractEmployeeVertexType.getParentType()); - assertNull(employeeVertexType.getParentType()); + assertThat(regularEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(contractEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(employeeVertexType.getParentType()).isNull(); - assertEquals(1, regularEmployeeVertexType.getInheritanceLevel()); - assertEquals(1, contractEmployeeVertexType.getInheritanceLevel()); - assertEquals(0, employeeVertexType.getInheritanceLevel()); + assertThat(regularEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeVertexType.getInheritanceLevel()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1471,18 +1467,18 @@ public void TablePerSubclassInheritanceSyntax2() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Table per Concrete Class Inheritance ( tag) * 3 tables, one parent and 2 childs ( http://www.javatpoint.com/table-per-concrete-class ) */ - public void TablePerConcreteClassInheritance() { + @Test + void TablePerConcreteClassInheritance() { Connection connection = null; Statement st = null; @@ -1529,15 +1525,15 @@ public void TablePerConcreteClassInheritance() { * Testing context information */ - assertEquals(4, statistics.totalNumberOfEntities); - assertEquals(4, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(4); + assertThat(statistics.builtEntities).isEqualTo(4); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); - assertEquals(4, statistics.totalNumberOfModelVertices); - assertEquals(4, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(4); + assertThat(statistics.builtModelVertexTypes).isEqualTo(4); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built source db schema @@ -1549,200 +1545,200 @@ public void TablePerConcreteClassInheritance() { Entity residenceEntity = mapper.getDataBaseSchema().getEntityByNameIgnoreCase("RESIDENCE"); // entities check - assertEquals(4, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(employeeEntity); - assertNotNull(regularEmployeeEntity); - assertNotNull(contractEmployeeEntity); - assertNotNull(residenceEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(4); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity).isNotNull(); + assertThat(regularEmployeeEntity).isNotNull(); + assertThat(contractEmployeeEntity).isNotNull(); + assertThat(residenceEntity).isNotNull(); // attributes check - assertEquals(3, employeeEntity.getAttributes().size()); - - assertNotNull(employeeEntity.getAttributeByName("ID")); - assertEquals("ID", employeeEntity.getAttributeByName("ID").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("ID").getDataType()); - assertEquals(1, employeeEntity.getAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("NAME")); - assertEquals("NAME", employeeEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, employeeEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(employeeEntity.getAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", employeeEntity.getAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", employeeEntity.getAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(2, regularEmployeeEntity.getAttributes().size()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("SALARY")); - assertEquals("SALARY", regularEmployeeEntity.getAttributeByName("SALARY").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("SALARY").getDataType()); - assertEquals(1, regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getAttributeByName("BONUS")); - assertEquals("BONUS", regularEmployeeEntity.getAttributeByName("BONUS").getName()); - assertEquals("DECIMAL", regularEmployeeEntity.getAttributeByName("BONUS").getDataType()); - assertEquals(2, regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()); - - assertEquals(2, contractEmployeeEntity.getAttributes().size()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")); - assertEquals("PAY_PER_HOUR", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()); - assertEquals("DECIMAL", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()); - assertEquals(1, contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")); - assertEquals("CONTRACT_DURATION", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()); - assertEquals(2, contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()); + assertThat(employeeEntity.getAttributes().size()).isEqualTo(3); + + assertThat(employeeEntity.getAttributeByName("ID")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(employeeEntity.getAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeEntity.getAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(employeeEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(employeeEntity.getAttributeByName("RESIDENCE")).isNotNull(); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeEntity.getAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(regularEmployeeEntity.getAttributeByName("SALARY")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getName()).isEqualTo("SALARY"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getAttributeByName("SALARY").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(regularEmployeeEntity.getAttributeByName("BONUS")).isNotNull(); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getName()).isEqualTo("BONUS"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getDataType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getAttributeByName("BONUS").getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributes().size()).isEqualTo(2); + + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getName()).isEqualTo("PAY_PER_HOUR"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getDataType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getAttributeByName("PAY_PER_HOUR").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION")).isNotNull(); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getName()).isEqualTo("CONTRACT_DURATION"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getAttributeByName("CONTRACT_DURATION").getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // inherited attributes check - assertEquals(0, employeeEntity.getInheritedAttributes().size()); - - assertEquals(3, regularEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", regularEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); - - assertEquals(3, contractEmployeeEntity.getInheritedAttributes().size()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("ID")); - assertEquals("ID", contractEmployeeEntity.getInheritedAttributeByName("ID").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()); - assertEquals(1, contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("NAME")); - assertEquals("NAME", contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()); - assertEquals(2, contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")); - assertEquals("RESIDENCE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()); - assertEquals(3, contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()); - assertEquals("EMPLOYEE", contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()); + assertThat(employeeEntity.getInheritedAttributes().size()).isEqualTo(0); + + assertThat(regularEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributes().size()).isEqualTo(3); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("ID").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); + + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE")).isNotNull(); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getName()).isEqualTo("RESIDENCE"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeEntity.getInheritedAttributeByName("RESIDENCE").getBelongingEntity().getName()).isEqualTo("EMPLOYEE"); // primary key check (not "inherited") - assertEquals(1, regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("REGULAR_EMPLOYEE", regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("REGULAR_EMPLOYEE"); - assertEquals(1, contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()); - assertEquals("ID", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("VARCHAR", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()); - assertEquals("CONTRACT_EMPLOYEE", contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getDataType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeEntity.getPrimaryKey().getInvolvedAttributes().get(0).getBelongingEntity().getName()).isEqualTo("CONTRACT_EMPLOYEE"); // relationship, primary and foreign key check - assertEquals(0, regularEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getOutCanonicalRelationships().size()); - assertEquals(1, employeeEntity.getOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getOutCanonicalRelationships().size()); - assertEquals(0, regularEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, contractEmployeeEntity.getInCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInCanonicalRelationships().size()); - assertEquals(1, residenceEntity.getInCanonicalRelationships().size()); - - assertEquals(0, regularEmployeeEntity.getForeignKeys().size()); - assertEquals(0, contractEmployeeEntity.getForeignKeys().size()); - assertEquals(1, employeeEntity.getForeignKeys().size()); - assertEquals(0, residenceEntity.getForeignKeys().size()); + assertThat(regularEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(residenceEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(regularEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(employeeEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInCanonicalRelationships().size()).isEqualTo(1); + + assertThat(regularEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(contractEmployeeEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(employeeEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(residenceEntity.getForeignKeys().size()).isEqualTo(0); Iterator itEmp = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentEmpRel = itEmp.next(); - assertEquals("RESIDENCE", currentEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentEmpRel.getPrimaryKey()); - assertEquals(employeeEntity.getForeignKeys().get(0), currentEmpRel.getForeignKey()); - assertFalse(itEmp.hasNext()); + assertThat(currentEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentEmpRel.getForeignKey()).isEqualTo(employeeEntity.getForeignKeys().get(0)); + assertThat(itEmp.hasNext()).isFalse(); Iterator itRes = residenceEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentResRel = itRes.next(); - assertEquals(currentEmpRel, currentResRel); + assertThat(currentResRel).isEqualTo(currentEmpRel); // inherited relationships check - assertEquals(1, regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(1, contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, employeeEntity.getInheritedOutCanonicalRelationships().size()); - assertEquals(0, residenceEntity.getInheritedOutCanonicalRelationships().size()); + assertThat(regularEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(employeeEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(residenceEntity.getInheritedOutCanonicalRelationships().size()).isEqualTo(0); Iterator itRegEmp = regularEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); Iterator itContEmp = contractEmployeeEntity.getInheritedOutCanonicalRelationships().iterator(); CanonicalRelationship currentRegEmpRel = itRegEmp.next(); CanonicalRelationship currentContEmpRel = itContEmp.next(); - assertEquals("RESIDENCE", currentRegEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentRegEmpRel.getForeignEntity().getName()); - assertEquals("RESIDENCE", currentContEmpRel.getParentEntity().getName()); - assertEquals("EMPLOYEE", currentContEmpRel.getForeignEntity().getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentRegEmpRel.getPrimaryKey()); - assertEquals(1, currentRegEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentRegEmpRel.getFromColumns().get(0).getName()); - assertEquals(residenceEntity.getPrimaryKey(), currentContEmpRel.getPrimaryKey()); - assertEquals(1, currentContEmpRel.getFromColumns().size()); - assertEquals("RESIDENCE", currentContEmpRel.getFromColumns().get(0).getName()); - assertFalse(itRegEmp.hasNext()); - assertFalse(itContEmp.hasNext()); + assertThat(currentRegEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentRegEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentContEmpRel.getParentEntity().getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getForeignEntity().getName()).isEqualTo("EMPLOYEE"); + assertThat(currentRegEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentRegEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentRegEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(currentContEmpRel.getPrimaryKey()).isEqualTo(residenceEntity.getPrimaryKey()); + assertThat(currentContEmpRel.getFromColumns().size()).isEqualTo(1); + assertThat(currentContEmpRel.getFromColumns().get(0).getName()).isEqualTo("RESIDENCE"); + assertThat(itRegEmp.hasNext()).isFalse(); + assertThat(itContEmp.hasNext()).isFalse(); // inheritance check - assertEquals(employeeEntity, regularEmployeeEntity.getParentEntity()); - assertEquals(employeeEntity, contractEmployeeEntity.getParentEntity()); - assertNull(employeeEntity.getParentEntity()); - assertNull(residenceEntity.getParentEntity()); + assertThat(regularEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(contractEmployeeEntity.getParentEntity()).isEqualTo(employeeEntity); + assertThat(employeeEntity.getParentEntity()).isNull(); + assertThat(residenceEntity.getParentEntity()).isNull(); - assertEquals(1, regularEmployeeEntity.getInheritanceLevel()); - assertEquals(1, contractEmployeeEntity.getInheritanceLevel()); - assertEquals(0, employeeEntity.getInheritanceLevel()); - assertEquals(0, residenceEntity.getInheritanceLevel()); + assertThat(regularEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeEntity.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeEntity.getInheritanceLevel()).isEqualTo(0); + assertThat(residenceEntity.getInheritanceLevel()).isEqualTo(0); // Hierarchical Bag check - assertEquals(1, mapper.getDataBaseSchema().getHierarchicalBags().size()); + assertThat(mapper.getDataBaseSchema().getHierarchicalBags().size()).isEqualTo(1); HierarchicalBag hierarchicalBag = mapper.getDataBaseSchema().getHierarchicalBags().get(0); - assertEquals("table-per-concrete-type", hierarchicalBag.getInheritancePattern()); + assertThat(hierarchicalBag.getInheritancePattern()).isEqualTo("table-per-concrete-type"); - assertEquals(2, hierarchicalBag.getDepth2entities().size()); + assertThat(hierarchicalBag.getDepth2entities().size()).isEqualTo(2); - assertEquals(1, hierarchicalBag.getDepth2entities().get(0).size()); + assertThat(hierarchicalBag.getDepth2entities().get(0).size()).isEqualTo(1); Iterator it = hierarchicalBag.getDepth2entities().get(0).iterator(); - assertEquals("EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, hierarchicalBag.getDepth2entities().get(1).size()); + assertThat(hierarchicalBag.getDepth2entities().get(1).size()).isEqualTo(2); it = hierarchicalBag.getDepth2entities().get(1).iterator(); - assertEquals("REGULAR_EMPLOYEE", it.next().getName()); - assertEquals("CONTRACT_EMPLOYEE", it.next().getName()); - assertTrue(!it.hasNext()); + assertThat(it.next().getName()).isEqualTo("REGULAR_EMPLOYEE"); + assertThat(it.next().getName()).isEqualTo("CONTRACT_EMPLOYEE"); + assertThat(it.hasNext()).isFalse(); - assertEquals(hierarchicalBag, employeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, regularEmployeeEntity.getHierarchicalBag()); - assertEquals(hierarchicalBag, contractEmployeeEntity.getHierarchicalBag()); + assertThat(employeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(regularEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); + assertThat(contractEmployeeEntity.getHierarchicalBag()).isEqualTo(hierarchicalBag); - assertNull(hierarchicalBag.getDiscriminatorColumn()); + assertThat(hierarchicalBag.getDiscriminatorColumn()).isNull(); /* * Testing built graph model @@ -1754,153 +1750,153 @@ public void TablePerConcreteClassInheritance() { VertexType residenceVertexType = mapper.getGraphModel().getVertexTypeByName("Residence"); // vertices check - assertEquals(4, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(regularEmployeeVertexType); - assertNotNull(contractEmployeeVertexType); - assertNotNull(residenceVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(4); + assertThat(employeeVertexType).isNotNull(); + assertThat(regularEmployeeVertexType).isNotNull(); + assertThat(contractEmployeeVertexType).isNotNull(); + assertThat(residenceVertexType).isNotNull(); // properties check - assertEquals(3, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("id")); - assertEquals("id", employeeVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("residence")); - assertEquals("residence", employeeVertexType.getPropertyByName("residence").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("residence").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(2, regularEmployeeVertexType.getProperties().size()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("salary")); - assertEquals("salary", regularEmployeeVertexType.getPropertyByName("salary").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getPropertyByName("bonus")); - assertEquals("bonus", regularEmployeeVertexType.getPropertyByName("bonus").getName()); - assertEquals("DECIMAL", regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()); - - assertEquals(2, contractEmployeeVertexType.getProperties().size()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("payPerHour")); - assertEquals("payPerHour", contractEmployeeVertexType.getPropertyByName("payPerHour").getName()); - assertEquals("DECIMAL", contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getPropertyByName("contractDuration")); - assertEquals("contractDuration", contractEmployeeVertexType.getPropertyByName("contractDuration").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()); - - assertEquals(3, residenceVertexType.getProperties().size()); - - assertNotNull(residenceVertexType.getPropertyByName("id")); - assertEquals("id", residenceVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, residenceVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, residenceVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("city")); - assertEquals("city", residenceVertexType.getPropertyByName("city").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("city").getOriginalType()); - assertEquals(2, residenceVertexType.getPropertyByName("city").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("city").isFromPrimaryKey()); - - assertNotNull(residenceVertexType.getPropertyByName("country")); - assertEquals("country", residenceVertexType.getPropertyByName("country").getName()); - assertEquals("VARCHAR", residenceVertexType.getPropertyByName("country").getOriginalType()); - assertEquals(3, residenceVertexType.getPropertyByName("country").getOrdinalPosition()); - assertEquals(false, residenceVertexType.getPropertyByName("country").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(3); + + assertThat(employeeVertexType.getPropertyByName("id")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(employeeVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("residence")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(employeeVertexType.getPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(regularEmployeeVertexType.getPropertyByName("salary")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getName()).isEqualTo("salary"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getPropertyByName("salary").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getPropertyByName("bonus")).isNotNull(); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getName()).isEqualTo("bonus"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getPropertyByName("bonus").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getProperties().size()).isEqualTo(2); + + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getName()).isEqualTo("payPerHour"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOriginalType()).isEqualTo("DECIMAL"); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getPropertyByName("payPerHour").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration")).isNotNull(); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getName()).isEqualTo("contractDuration"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getPropertyByName("contractDuration").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getProperties().size()).isEqualTo(3); + + assertThat(residenceVertexType.getPropertyByName("id")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(residenceVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(residenceVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(residenceVertexType.getPropertyByName("city")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("city").getName()).isEqualTo("city"); + assertThat(residenceVertexType.getPropertyByName("city").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("city").getOrdinalPosition()).isEqualTo(2); + assertThat(residenceVertexType.getPropertyByName("city").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getPropertyByName("country")).isNotNull(); + assertThat(residenceVertexType.getPropertyByName("country").getName()).isEqualTo("country"); + assertThat(residenceVertexType.getPropertyByName("country").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(residenceVertexType.getPropertyByName("country").getOrdinalPosition()).isEqualTo(3); + assertThat(residenceVertexType.getPropertyByName("country").isFromPrimaryKey()).isFalse(); // inherited properties check - assertEquals(0, employeeVertexType.getInheritedProperties().size()); - - assertEquals(3, regularEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", regularEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", regularEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(regularEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(3, contractEmployeeVertexType.getInheritedProperties().size()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("id")); - assertEquals("id", contractEmployeeVertexType.getInheritedPropertyByName("id").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()); - assertEquals(1, contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()); - assertEquals(true, contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("name")); - assertEquals("name", contractEmployeeVertexType.getInheritedPropertyByName("name").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()); - assertEquals(2, contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(contractEmployeeVertexType.getInheritedPropertyByName("residence")); - assertEquals("residence", contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()); - assertEquals("VARCHAR", contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()); - assertEquals(3, contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()); - assertEquals(false, contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()); - - assertEquals(0, residenceVertexType.getInheritedProperties().size()); + assertThat(employeeVertexType.getInheritedProperties().size()).isEqualTo(0); + + assertThat(regularEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(regularEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedProperties().size()).isEqualTo(3); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getName()).isEqualTo("id"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getName()).isEqualTo("name"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence")).isNotNull(); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getName()).isEqualTo("residence"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").getOrdinalPosition()).isEqualTo(3); + assertThat(contractEmployeeVertexType.getInheritedPropertyByName("residence").isFromPrimaryKey()).isFalse(); + + assertThat(residenceVertexType.getInheritedProperties().size()).isEqualTo(0); // edges check - assertEquals(1, mapper.getRelationship2edgeType().size()); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertEquals("HasResidence", mapper.getGraphModel().getEdgesType().get(0).getName()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(mapper.getGraphModel().getEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, employeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", employeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(employeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(employeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, regularEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", regularEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(regularEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(regularEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); - assertEquals(1, contractEmployeeVertexType.getOutEdgesType().size()); - assertEquals("HasResidence", contractEmployeeVertexType.getOutEdgesType().get(0).getName()); + assertThat(contractEmployeeVertexType.getOutEdgesType().size()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getOutEdgesType().get(0).getName()).isEqualTo("HasResidence"); // inheritance check - assertEquals(employeeVertexType, regularEmployeeVertexType.getParentType()); - assertEquals(employeeVertexType, contractEmployeeVertexType.getParentType()); - assertNull(employeeVertexType.getParentType()); + assertThat(regularEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(contractEmployeeVertexType.getParentType()).isEqualTo(employeeVertexType); + assertThat(employeeVertexType.getParentType()).isNull(); - assertEquals(1, regularEmployeeVertexType.getInheritanceLevel()); - assertEquals(1, contractEmployeeVertexType.getInheritanceLevel()); - assertEquals(0, employeeVertexType.getInheritanceLevel()); + assertThat(regularEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(contractEmployeeVertexType.getInheritanceLevel()).isEqualTo(1); + assertThat(employeeVertexType.getInheritanceLevel()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(e); + fail("", e); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1909,7 +1905,7 @@ public void TablePerConcreteClassInheritance() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(e); + fail("", e); } } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/jointableaggregation/AggregationStrategyTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/jointableaggregation/AggregationStrategyTest.java index 083f4448..5c92d9db 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/jointableaggregation/AggregationStrategyTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/jointableaggregation/AggregationStrategyTest.java @@ -40,12 +40,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.context.Statistics; @@ -71,7 +67,7 @@ * @author Gabriele Ponzi */ -public class AggregationStrategyTest { +class AggregationStrategyTest { private DBQueryEngine dbQueryEngine; private String driver = "org.hsqldb.jdbc.JDBCDriver"; @@ -86,7 +82,7 @@ public class AggregationStrategyTest { private Statistics statistics; @BeforeEach - public void init() { + void init() { this.dataSource = new DataSourceInfo( 1L, @@ -114,10 +110,10 @@ public void init() { statistics = new Statistics(); } - @Test /* * Aggregation Strategy Test: executing mapping - */public void performMappingWithAggregationStrategy() { + */@Test + void performMappingWithAggregationStrategy() { Connection connection = null; Statement st = null; @@ -159,10 +155,10 @@ public void init() { * Testing context information */ - assertEquals(5, statistics.totalNumberOfModelVertices); - assertEquals(5, statistics.builtModelVertexTypes); - assertEquals(2, statistics.totalNumberOfModelEdges); - assertEquals(2, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(5); + assertThat(statistics.builtModelVertexTypes).isEqualTo(5); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(2); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(2); /* * Testing built graph model @@ -176,19 +172,19 @@ public void init() { EdgeType empEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasEmp"); // vertices check - assertEquals(5, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(departmentVertexType); - assertNotNull(deptEmpVertexType); - assertNotNull(deptManagerVertexType); - assertNotNull(branchVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(5); + assertThat(employeeVertexType).isNotNull(); + assertThat(departmentVertexType).isNotNull(); + assertThat(deptEmpVertexType).isNotNull(); + assertThat(deptManagerVertexType).isNotNull(); + assertThat(branchVertexType).isNotNull(); // edges check - assertEquals(2, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(deptEdgeType); - assertNotNull(empEdgeType); - assertEquals(3, deptEdgeType.getNumberRelationshipsRepresented()); - assertEquals(2, empEdgeType.getNumberRelationshipsRepresented()); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(2); + assertThat(deptEdgeType).isNotNull(); + assertThat(empEdgeType).isNotNull(); + assertThat(deptEdgeType.getNumberRelationshipsRepresented()).isEqualTo(3); + assertThat(empEdgeType.getNumberRelationshipsRepresented()).isEqualTo(2); /* * Rules check @@ -196,123 +192,123 @@ public void init() { // Classes Mapping - assertEquals(5, mapper.getVertexType2EVClassMappers().size()); - assertEquals(5, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(5); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(5); Entity employeeEntity = mapper.getDataBaseSchema().getEntityByName("EMPLOYEE"); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(3, employeeClassMapper.getAttribute2property().size()); - assertEquals(3, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("firstName", employeeClassMapper.getAttribute2property().get("FIRST_NAME")); - assertEquals("lastName", employeeClassMapper.getAttribute2property().get("LAST_NAME")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("FIRST_NAME", employeeClassMapper.getProperty2attribute().get("firstName")); - assertEquals("LAST_NAME", employeeClassMapper.getProperty2attribute().get("lastName")); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("FIRST_NAME")).isEqualTo("firstName"); + assertThat(employeeClassMapper.getAttribute2property().get("LAST_NAME")).isEqualTo("lastName"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("firstName")).isEqualTo("FIRST_NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("lastName")).isEqualTo("LAST_NAME"); Entity departmentEntity = mapper.getDataBaseSchema().getEntityByName("DEPARTMENT"); - assertEquals(1, mapper.getEVClassMappersByVertex(departmentVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(departmentVertexType).size()).isEqualTo(1); EVClassMapper departmentClassMapper = mapper.getEVClassMappersByVertex(departmentVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(departmentEntity).size()); - assertEquals(departmentClassMapper, mapper.getEVClassMappersByEntity(departmentEntity).get(0)); - assertEquals(departmentClassMapper.getEntity(), departmentEntity); - assertEquals(departmentClassMapper.getVertexType(), departmentVertexType); - - assertEquals(2, departmentClassMapper.getAttribute2property().size()); - assertEquals(2, departmentClassMapper.getProperty2attribute().size()); - assertEquals("id", departmentClassMapper.getAttribute2property().get("ID")); - assertEquals("name", departmentClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", departmentClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", departmentClassMapper.getProperty2attribute().get("name")); + assertThat(mapper.getEVClassMappersByEntity(departmentEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(departmentEntity).get(0)).isEqualTo(departmentClassMapper); + assertThat(departmentEntity).isEqualTo(departmentClassMapper.getEntity()); + assertThat(departmentVertexType).isEqualTo(departmentClassMapper.getVertexType()); + + assertThat(departmentClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(departmentClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(departmentClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(departmentClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(departmentClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(departmentClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); Entity branchEntity = mapper.getDataBaseSchema().getEntityByName("BRANCH"); - assertEquals(1, mapper.getEVClassMappersByVertex(branchVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(branchVertexType).size()).isEqualTo(1); EVClassMapper branchClassMapper = mapper.getEVClassMappersByVertex(branchVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(branchEntity).size()); - assertEquals(branchClassMapper, mapper.getEVClassMappersByEntity(branchEntity).get(0)); - assertEquals(branchClassMapper.getEntity(), branchEntity); - assertEquals(branchClassMapper.getVertexType(), branchVertexType); - - assertEquals(3, branchClassMapper.getAttribute2property().size()); - assertEquals(3, branchClassMapper.getProperty2attribute().size()); - assertEquals("branchId", branchClassMapper.getAttribute2property().get("BRANCH_ID")); - assertEquals("location", branchClassMapper.getAttribute2property().get("LOCATION")); - assertEquals("dept", branchClassMapper.getAttribute2property().get("DEPT")); - assertEquals("BRANCH_ID", branchClassMapper.getProperty2attribute().get("branchId")); - assertEquals("LOCATION", branchClassMapper.getProperty2attribute().get("location")); - assertEquals("DEPT", branchClassMapper.getProperty2attribute().get("dept")); + assertThat(mapper.getEVClassMappersByEntity(branchEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(branchEntity).get(0)).isEqualTo(branchClassMapper); + assertThat(branchEntity).isEqualTo(branchClassMapper.getEntity()); + assertThat(branchVertexType).isEqualTo(branchClassMapper.getVertexType()); + + assertThat(branchClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(branchClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(branchClassMapper.getAttribute2property().get("BRANCH_ID")).isEqualTo("branchId"); + assertThat(branchClassMapper.getAttribute2property().get("LOCATION")).isEqualTo("location"); + assertThat(branchClassMapper.getAttribute2property().get("DEPT")).isEqualTo("dept"); + assertThat(branchClassMapper.getProperty2attribute().get("branchId")).isEqualTo("BRANCH_ID"); + assertThat(branchClassMapper.getProperty2attribute().get("location")).isEqualTo("LOCATION"); + assertThat(branchClassMapper.getProperty2attribute().get("dept")).isEqualTo("DEPT"); Entity deptEmpEntity = mapper.getDataBaseSchema().getEntityByName("DEPT_EMP"); - assertEquals(1, mapper.getEVClassMappersByVertex(deptEmpVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(deptEmpVertexType).size()).isEqualTo(1); EVClassMapper deptEmpClassMapper = mapper.getEVClassMappersByVertex(deptEmpVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(deptEmpEntity).size()); - assertEquals(deptEmpClassMapper, mapper.getEVClassMappersByEntity(deptEmpEntity).get(0)); - assertEquals(deptEmpClassMapper.getEntity(), deptEmpEntity); - assertEquals(deptEmpClassMapper.getVertexType(), deptEmpVertexType); - - assertEquals(3, deptEmpClassMapper.getAttribute2property().size()); - assertEquals(3, deptEmpClassMapper.getProperty2attribute().size()); - assertEquals("deptId", deptEmpClassMapper.getAttribute2property().get("DEPT_ID")); - assertEquals("empId", deptEmpClassMapper.getAttribute2property().get("EMP_ID")); - assertEquals("hiringYear", deptEmpClassMapper.getAttribute2property().get("HIRING_YEAR")); - assertEquals("DEPT_ID", deptEmpClassMapper.getProperty2attribute().get("deptId")); - assertEquals("EMP_ID", deptEmpClassMapper.getProperty2attribute().get("empId")); - assertEquals("HIRING_YEAR", deptEmpClassMapper.getProperty2attribute().get("hiringYear")); + assertThat(mapper.getEVClassMappersByEntity(deptEmpEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(deptEmpEntity).get(0)).isEqualTo(deptEmpClassMapper); + assertThat(deptEmpEntity).isEqualTo(deptEmpClassMapper.getEntity()); + assertThat(deptEmpVertexType).isEqualTo(deptEmpClassMapper.getVertexType()); + + assertThat(deptEmpClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(deptEmpClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(deptEmpClassMapper.getAttribute2property().get("DEPT_ID")).isEqualTo("deptId"); + assertThat(deptEmpClassMapper.getAttribute2property().get("EMP_ID")).isEqualTo("empId"); + assertThat(deptEmpClassMapper.getAttribute2property().get("HIRING_YEAR")).isEqualTo("hiringYear"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("deptId")).isEqualTo("DEPT_ID"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("empId")).isEqualTo("EMP_ID"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("hiringYear")).isEqualTo("HIRING_YEAR"); Entity deptMgrEntity = mapper.getDataBaseSchema().getEntityByName("DEPT_MANAGER"); - assertEquals(1, mapper.getEVClassMappersByVertex(deptManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(deptManagerVertexType).size()).isEqualTo(1); EVClassMapper deptManagerClassMapper = mapper.getEVClassMappersByVertex(deptManagerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(deptMgrEntity).size()); - assertEquals(deptManagerClassMapper, mapper.getEVClassMappersByEntity(deptMgrEntity).get(0)); - assertEquals(deptManagerClassMapper.getEntity(), deptMgrEntity); - assertEquals(deptManagerClassMapper.getVertexType(), deptManagerVertexType); - - assertEquals(2, deptManagerClassMapper.getAttribute2property().size()); - assertEquals(2, deptManagerClassMapper.getProperty2attribute().size()); - assertEquals("deptId", deptManagerClassMapper.getAttribute2property().get("DEPT_ID")); - assertEquals("empId", deptManagerClassMapper.getAttribute2property().get("EMP_ID")); - assertEquals("DEPT_ID", deptManagerClassMapper.getProperty2attribute().get("deptId")); - assertEquals("EMP_ID", deptManagerClassMapper.getProperty2attribute().get("empId")); + assertThat(mapper.getEVClassMappersByEntity(deptMgrEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(deptMgrEntity).get(0)).isEqualTo(deptManagerClassMapper); + assertThat(deptMgrEntity).isEqualTo(deptManagerClassMapper.getEntity()); + assertThat(deptManagerVertexType).isEqualTo(deptManagerClassMapper.getVertexType()); + + assertThat(deptManagerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(deptManagerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(deptManagerClassMapper.getAttribute2property().get("DEPT_ID")).isEqualTo("deptId"); + assertThat(deptManagerClassMapper.getAttribute2property().get("EMP_ID")).isEqualTo("empId"); + assertThat(deptManagerClassMapper.getProperty2attribute().get("deptId")).isEqualTo("DEPT_ID"); + assertThat(deptManagerClassMapper.getProperty2attribute().get("empId")).isEqualTo("EMP_ID"); // Relationships-Edges Mapping Iterator it = deptEmpEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasDepartmentRelationship1 = it.next(); CanonicalRelationship hasEmployeeRelationship1 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = deptMgrEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasDepartmentRelationship2 = it.next(); CanonicalRelationship hasEmployeeRelationship2 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = branchEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasDepartmentRelationship3 = it.next(); - assertFalse(it.hasNext()); - - assertEquals(5, mapper.getRelationship2edgeType().size()); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship1)); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship2)); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship3)); - assertEquals(empEdgeType, mapper.getRelationship2edgeType().get(hasEmployeeRelationship1)); - assertEquals(empEdgeType, mapper.getRelationship2edgeType().get(hasEmployeeRelationship2)); - - assertEquals(2, mapper.getEdgeType2relationships().size()); - assertEquals(3, mapper.getEdgeType2relationships().get(deptEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship1)); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship2)); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship3)); - assertEquals(2, mapper.getEdgeType2relationships().get(empEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship1)); - assertTrue(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship2)); - - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(it.hasNext()).isFalse(); + + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(5); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship1)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship2)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship3)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasEmployeeRelationship1)).isEqualTo(empEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasEmployeeRelationship2)).isEqualTo(empEdgeType); + + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).size()).isEqualTo(3); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship1)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship2)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship3)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship1)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship2)).isTrue(); + + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); /* * Aggregation of join tables @@ -323,10 +319,10 @@ public void init() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(3, statistics.totalNumberOfModelEdges); - assertEquals(3, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(3); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(3); /* * Testing built graph model @@ -340,25 +336,25 @@ public void init() { EdgeType deptManagerEdgeType = mapper.getGraphModel().getEdgeTypeByName("DeptManager"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(departmentVertexType); - assertNull(mapper.getGraphModel().getVertexTypeByName("DeptEmp")); - assertNull(mapper.getGraphModel().getVertexTypeByName("DeptManager")); - assertNotNull(branchVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(employeeVertexType).isNotNull(); + assertThat(departmentVertexType).isNotNull(); + assertThat(mapper.getGraphModel().getVertexTypeByName("DeptEmp")).isNull(); + assertThat(mapper.getGraphModel().getVertexTypeByName("DeptManager")).isNull(); + assertThat(branchVertexType).isNotNull(); // edges check - assertEquals(3, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(deptEdgeType); - assertNotNull(deptEmpEdgeType); - assertNotNull(deptManagerEdgeType); - assertNull(mapper.getGraphModel().getEdgeTypeByName("HasEmp")); - assertEquals(1, deptEdgeType.getNumberRelationshipsRepresented()); - assertEquals(1, deptEmpEdgeType.getNumberRelationshipsRepresented()); - assertEquals(1, deptManagerEdgeType.getNumberRelationshipsRepresented()); - - assertNotNull(deptEmpEdgeType.getPropertyByName("hiringYear")); - assertTrue(deptEmpEdgeType.getPropertyByName("hiringYear").getOriginalType().equals("VARCHAR")); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(3); + assertThat(deptEdgeType).isNotNull(); + assertThat(deptEmpEdgeType).isNotNull(); + assertThat(deptManagerEdgeType).isNotNull(); + assertThat(mapper.getGraphModel().getEdgeTypeByName("HasEmp")).isNull(); + assertThat(deptEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); + assertThat(deptEmpEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); + assertThat(deptManagerEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); + + assertThat(deptEmpEdgeType.getPropertyByName("hiringYear")).isNotNull(); + assertThat(deptEmpEdgeType.getPropertyByName("hiringYear").getOriginalType()).isEqualTo("VARCHAR"); /* * Rules check @@ -366,141 +362,141 @@ public void init() { // Classes Mapping - assertEquals(5, mapper.getVertexType2EVClassMappers().size()); - assertEquals(5, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(5); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(5); employeeEntity = mapper.getDataBaseSchema().getEntityByName("EMPLOYEE"); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(3, employeeClassMapper.getAttribute2property().size()); - assertEquals(3, employeeClassMapper.getProperty2attribute().size()); - assertEquals("id", employeeClassMapper.getAttribute2property().get("ID")); - assertEquals("firstName", employeeClassMapper.getAttribute2property().get("FIRST_NAME")); - assertEquals("lastName", employeeClassMapper.getAttribute2property().get("LAST_NAME")); - assertEquals("ID", employeeClassMapper.getProperty2attribute().get("id")); - assertEquals("FIRST_NAME", employeeClassMapper.getProperty2attribute().get("firstName")); - assertEquals("LAST_NAME", employeeClassMapper.getProperty2attribute().get("lastName")); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(employeeClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(employeeClassMapper.getAttribute2property().get("FIRST_NAME")).isEqualTo("firstName"); + assertThat(employeeClassMapper.getAttribute2property().get("LAST_NAME")).isEqualTo("lastName"); + assertThat(employeeClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("firstName")).isEqualTo("FIRST_NAME"); + assertThat(employeeClassMapper.getProperty2attribute().get("lastName")).isEqualTo("LAST_NAME"); departmentEntity = mapper.getDataBaseSchema().getEntityByName("DEPARTMENT"); - assertEquals(1, mapper.getEVClassMappersByVertex(departmentVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(departmentVertexType).size()).isEqualTo(1); departmentClassMapper = mapper.getEVClassMappersByVertex(departmentVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(departmentEntity).size()); - assertEquals(departmentClassMapper, mapper.getEVClassMappersByEntity(departmentEntity).get(0)); - assertEquals(departmentClassMapper.getEntity(), departmentEntity); - assertEquals(departmentClassMapper.getVertexType(), departmentVertexType); - - assertEquals(2, departmentClassMapper.getAttribute2property().size()); - assertEquals(2, departmentClassMapper.getProperty2attribute().size()); - assertEquals("id", departmentClassMapper.getAttribute2property().get("ID")); - assertEquals("name", departmentClassMapper.getAttribute2property().get("NAME")); - assertEquals("ID", departmentClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", departmentClassMapper.getProperty2attribute().get("name")); + assertThat(mapper.getEVClassMappersByEntity(departmentEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(departmentEntity).get(0)).isEqualTo(departmentClassMapper); + assertThat(departmentEntity).isEqualTo(departmentClassMapper.getEntity()); + assertThat(departmentVertexType).isEqualTo(departmentClassMapper.getVertexType()); + + assertThat(departmentClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(departmentClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(departmentClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(departmentClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(departmentClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(departmentClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); branchEntity = mapper.getDataBaseSchema().getEntityByName("BRANCH"); - assertEquals(1, mapper.getEVClassMappersByVertex(branchVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(branchVertexType).size()).isEqualTo(1); branchClassMapper = mapper.getEVClassMappersByVertex(branchVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(branchEntity).size()); - assertEquals(branchClassMapper, mapper.getEVClassMappersByEntity(branchEntity).get(0)); - assertEquals(branchClassMapper.getEntity(), branchEntity); - assertEquals(branchClassMapper.getVertexType(), branchVertexType); - - assertEquals(3, branchClassMapper.getAttribute2property().size()); - assertEquals(3, branchClassMapper.getProperty2attribute().size()); - assertEquals("branchId", branchClassMapper.getAttribute2property().get("BRANCH_ID")); - assertEquals("location", branchClassMapper.getAttribute2property().get("LOCATION")); - assertEquals("dept", branchClassMapper.getAttribute2property().get("DEPT")); - assertEquals("BRANCH_ID", branchClassMapper.getProperty2attribute().get("branchId")); - assertEquals("LOCATION", branchClassMapper.getProperty2attribute().get("location")); - assertEquals("DEPT", branchClassMapper.getProperty2attribute().get("dept")); + assertThat(mapper.getEVClassMappersByEntity(branchEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(branchEntity).get(0)).isEqualTo(branchClassMapper); + assertThat(branchEntity).isEqualTo(branchClassMapper.getEntity()); + assertThat(branchVertexType).isEqualTo(branchClassMapper.getVertexType()); + + assertThat(branchClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(branchClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(branchClassMapper.getAttribute2property().get("BRANCH_ID")).isEqualTo("branchId"); + assertThat(branchClassMapper.getAttribute2property().get("LOCATION")).isEqualTo("location"); + assertThat(branchClassMapper.getAttribute2property().get("DEPT")).isEqualTo("dept"); + assertThat(branchClassMapper.getProperty2attribute().get("branchId")).isEqualTo("BRANCH_ID"); + assertThat(branchClassMapper.getProperty2attribute().get("location")).isEqualTo("LOCATION"); + assertThat(branchClassMapper.getProperty2attribute().get("dept")).isEqualTo("DEPT"); deptEmpEntity = mapper.getDataBaseSchema().getEntityByName("DEPT_EMP"); - assertEquals(1, mapper.getEVClassMappersByVertex(deptEmpVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(deptEmpVertexType).size()).isEqualTo(1); deptEmpClassMapper = mapper.getEVClassMappersByVertex(deptEmpVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(deptEmpEntity).size()); - assertEquals(deptEmpClassMapper, mapper.getEVClassMappersByEntity(deptEmpEntity).get(0)); - assertEquals(deptEmpClassMapper.getEntity(), deptEmpEntity); - assertEquals(deptEmpClassMapper.getVertexType(), deptEmpVertexType); - - assertEquals(3, deptEmpClassMapper.getAttribute2property().size()); - assertEquals(3, deptEmpClassMapper.getProperty2attribute().size()); - assertEquals("deptId", deptEmpClassMapper.getAttribute2property().get("DEPT_ID")); - assertEquals("empId", deptEmpClassMapper.getAttribute2property().get("EMP_ID")); - assertEquals("hiringYear", deptEmpClassMapper.getAttribute2property().get("HIRING_YEAR")); - assertEquals("DEPT_ID", deptEmpClassMapper.getProperty2attribute().get("deptId")); - assertEquals("EMP_ID", deptEmpClassMapper.getProperty2attribute().get("empId")); - assertEquals("HIRING_YEAR", deptEmpClassMapper.getProperty2attribute().get("hiringYear")); + assertThat(mapper.getEVClassMappersByEntity(deptEmpEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(deptEmpEntity).get(0)).isEqualTo(deptEmpClassMapper); + assertThat(deptEmpEntity).isEqualTo(deptEmpClassMapper.getEntity()); + assertThat(deptEmpVertexType).isEqualTo(deptEmpClassMapper.getVertexType()); + + assertThat(deptEmpClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(deptEmpClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(deptEmpClassMapper.getAttribute2property().get("DEPT_ID")).isEqualTo("deptId"); + assertThat(deptEmpClassMapper.getAttribute2property().get("EMP_ID")).isEqualTo("empId"); + assertThat(deptEmpClassMapper.getAttribute2property().get("HIRING_YEAR")).isEqualTo("hiringYear"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("deptId")).isEqualTo("DEPT_ID"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("empId")).isEqualTo("EMP_ID"); + assertThat(deptEmpClassMapper.getProperty2attribute().get("hiringYear")).isEqualTo("HIRING_YEAR"); deptMgrEntity = mapper.getDataBaseSchema().getEntityByName("DEPT_MANAGER"); - assertEquals(1, mapper.getEVClassMappersByVertex(deptManagerVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(deptManagerVertexType).size()).isEqualTo(1); deptManagerClassMapper = mapper.getEVClassMappersByVertex(deptManagerVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(deptMgrEntity).size()); - assertEquals(deptManagerClassMapper, mapper.getEVClassMappersByEntity(deptMgrEntity).get(0)); - assertEquals(deptManagerClassMapper.getEntity(), deptMgrEntity); - assertEquals(deptManagerClassMapper.getVertexType(), deptManagerVertexType); - - assertEquals(2, deptManagerClassMapper.getAttribute2property().size()); - assertEquals(2, deptManagerClassMapper.getProperty2attribute().size()); - assertEquals("deptId", deptManagerClassMapper.getAttribute2property().get("DEPT_ID")); - assertEquals("empId", deptManagerClassMapper.getAttribute2property().get("EMP_ID")); - assertEquals("DEPT_ID", deptManagerClassMapper.getProperty2attribute().get("deptId")); - assertEquals("EMP_ID", deptManagerClassMapper.getProperty2attribute().get("empId")); + assertThat(mapper.getEVClassMappersByEntity(deptMgrEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(deptMgrEntity).get(0)).isEqualTo(deptManagerClassMapper); + assertThat(deptMgrEntity).isEqualTo(deptManagerClassMapper.getEntity()); + assertThat(deptManagerVertexType).isEqualTo(deptManagerClassMapper.getVertexType()); + + assertThat(deptManagerClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(deptManagerClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(deptManagerClassMapper.getAttribute2property().get("DEPT_ID")).isEqualTo("deptId"); + assertThat(deptManagerClassMapper.getAttribute2property().get("EMP_ID")).isEqualTo("empId"); + assertThat(deptManagerClassMapper.getProperty2attribute().get("deptId")).isEqualTo("DEPT_ID"); + assertThat(deptManagerClassMapper.getProperty2attribute().get("empId")).isEqualTo("EMP_ID"); // Relationships-Edges Mapping it = deptEmpEntity.getOutCanonicalRelationships().iterator(); hasDepartmentRelationship1 = it.next(); hasEmployeeRelationship1 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = deptMgrEntity.getOutCanonicalRelationships().iterator(); hasDepartmentRelationship2 = it.next(); hasEmployeeRelationship2 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = branchEntity.getOutCanonicalRelationships().iterator(); hasDepartmentRelationship3 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); // fetching empEdgeType from the rules as was deleted from the graph model during the aggregation - assertEquals("HasEmp", empEdgeType.getName()); - assertEquals(employeeVertexType, empEdgeType.getInVertexType()); - assertEquals(0, empEdgeType.getAllProperties().size()); - - assertEquals(5, mapper.getRelationship2edgeType().size()); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship1)); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship2)); - assertEquals(deptEdgeType, mapper.getRelationship2edgeType().get(hasDepartmentRelationship3)); - assertEquals(empEdgeType, mapper.getRelationship2edgeType().get(hasEmployeeRelationship1)); - assertEquals(empEdgeType, mapper.getRelationship2edgeType().get(hasEmployeeRelationship2)); - - assertEquals(2, mapper.getEdgeType2relationships().size()); - assertEquals(3, mapper.getEdgeType2relationships().get(deptEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship1)); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship2)); - assertTrue(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship3)); - assertEquals(2, mapper.getEdgeType2relationships().get(empEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship1)); - assertTrue(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship2)); + assertThat(empEdgeType.getName()).isEqualTo("HasEmp"); + assertThat(empEdgeType.getInVertexType()).isEqualTo(employeeVertexType); + assertThat(empEdgeType.getAllProperties().size()).isEqualTo(0); + + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(5); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship1)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship2)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasDepartmentRelationship3)).isEqualTo(deptEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasEmployeeRelationship1)).isEqualTo(empEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasEmployeeRelationship2)).isEqualTo(empEdgeType); + + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).size()).isEqualTo(3); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship1)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship2)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(deptEdgeType).contains(hasDepartmentRelationship3)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship1)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(empEdgeType).contains(hasEmployeeRelationship2)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(2, mapper.getJoinVertex2aggregatorEdges().size()); - assertTrue(mapper.getJoinVertex2aggregatorEdges().containsKey(deptManagerVertexType)); - assertTrue(mapper.getJoinVertex2aggregatorEdges().containsKey(deptEmpVertexType)); - assertEquals(deptManagerEdgeType, mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getEdgeType()); - assertEquals("Department", mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getOutVertexClassName()); - assertEquals("Employee", mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getInVertexClassName()); - assertEquals(deptEmpEdgeType, mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getEdgeType()); - assertEquals("Department", mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getOutVertexClassName()); - assertEquals("Employee", mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getInVertexClassName()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(2); + assertThat(mapper.getJoinVertex2aggregatorEdges().containsKey(deptManagerVertexType)).isTrue(); + assertThat(mapper.getJoinVertex2aggregatorEdges().containsKey(deptEmpVertexType)).isTrue(); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getEdgeType()).isEqualTo(deptManagerEdgeType); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getOutVertexClassName()).isEqualTo("Department"); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptManagerVertexType).getInVertexClassName()).isEqualTo("Employee"); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getEdgeType()).isEqualTo(deptEmpEdgeType); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getOutVertexClassName()).isEqualTo("Department"); + assertThat(mapper.getJoinVertex2aggregatorEdges().get(deptEmpVertexType).getInVertexClassName()).isEqualTo("Employee"); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -509,7 +505,7 @@ public void init() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/GraphModelBuildingTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/GraphModelBuildingTest.java index a35ed40b..137a8872 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/GraphModelBuildingTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/GraphModelBuildingTest.java @@ -40,11 +40,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.context.Statistics; @@ -69,7 +66,7 @@ * @author Gabriele Ponzi */ -public class GraphModelBuildingTest { +class GraphModelBuildingTest { private ER2GraphMapper mapper; private DBQueryEngine dbQueryEngine; @@ -84,7 +81,7 @@ public class GraphModelBuildingTest { private HSQLDBDataTypeHandler dataTypeHandler; @BeforeEach - public void init() { + void init() { this.dataSource = new DataSourceInfo( 1L, @@ -114,12 +111,12 @@ public void init() { dataTypeHandler = new HSQLDBDataTypeHandler(); } - @Test /* * Two tables Foreign and Parent with a simple primary key imported from the parent table. */ - public void buildGraphModelFromTwoTablesWithOneSimplePK() { + @Test + void buildGraphModelFromTwoTablesWithOneSimplePK() { Connection connection = null; Statement st = null; @@ -145,10 +142,10 @@ public void buildGraphModelFromTwoTablesWithOneSimplePK() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfModelVertices); - assertEquals(2, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(2); + assertThat(statistics.builtModelVertexTypes).isEqualTo(2); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built graph model @@ -158,59 +155,59 @@ public void buildGraphModelFromTwoTablesWithOneSimplePK() { EdgeType authorEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasAuthor"); // vertices check - assertEquals(2, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(authorVertexType); - assertNotNull(bookVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(2); + assertThat(authorVertexType).isNotNull(); + assertThat(bookVertexType).isNotNull(); // properties check - assertEquals(3, authorVertexType.getProperties().size()); - - assertNotNull(authorVertexType.getPropertyByName("id")); - assertEquals("id", authorVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, authorVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, authorVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("name")); - assertEquals("name", authorVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, authorVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("age")); - assertEquals("age", authorVertexType.getPropertyByName("age").getName()); - assertEquals("INTEGER", authorVertexType.getPropertyByName("age").getOriginalType()); - assertEquals(3, authorVertexType.getPropertyByName("age").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("age").isFromPrimaryKey()); - - assertEquals(3, bookVertexType.getProperties().size()); - - assertNotNull(bookVertexType.getPropertyByName("id")); - assertEquals("id", bookVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, bookVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, bookVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("title")); - assertEquals("title", bookVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, bookVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("authorId")); - assertEquals("authorId", bookVertexType.getPropertyByName("authorId").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("authorId").getOriginalType()); - assertEquals(3, bookVertexType.getPropertyByName("authorId").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()); + assertThat(authorVertexType.getProperties().size()).isEqualTo(3); + + assertThat(authorVertexType.getPropertyByName("id")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(authorVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(authorVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(authorVertexType.getPropertyByName("name")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(authorVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(authorVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(authorVertexType.getPropertyByName("age")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("age").getName()).isEqualTo("age"); + assertThat(authorVertexType.getPropertyByName("age").getOriginalType()).isEqualTo("INTEGER"); + assertThat(authorVertexType.getPropertyByName("age").getOrdinalPosition()).isEqualTo(3); + assertThat(authorVertexType.getPropertyByName("age").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getProperties().size()).isEqualTo(3); + + assertThat(bookVertexType.getPropertyByName("id")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(bookVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(bookVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(bookVertexType.getPropertyByName("title")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(bookVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(bookVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getPropertyByName("authorId")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("authorId").getName()).isEqualTo("authorId"); + assertThat(bookVertexType.getPropertyByName("authorId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("authorId").getOrdinalPosition()).isEqualTo(3); + assertThat(bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(authorEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(authorEdgeType).isNotNull(); - assertEquals("HasAuthor", authorEdgeType.getName()); - assertEquals(0, authorEdgeType.getProperties().size()); - assertEquals("BookAuthor", authorEdgeType.getInVertexType().getName()); - assertEquals(1, authorEdgeType.getNumberRelationshipsRepresented()); + assertThat(authorEdgeType.getName()).isEqualTo("HasAuthor"); + assertThat(authorEdgeType.getProperties().size()).isEqualTo(0); + assertThat(authorEdgeType.getInVertexType().getName()).isEqualTo("BookAuthor"); + assertThat(authorEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); /* * Rules check @@ -218,62 +215,62 @@ public void buildGraphModelFromTwoTablesWithOneSimplePK() { // Classes Mapping - assertEquals(2, mapper.getVertexType2EVClassMappers().size()); - assertEquals(2, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(2); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(2); Entity bookEntity = mapper.getDataBaseSchema().getEntityByName("BOOK"); - assertEquals(1, mapper.getEVClassMappersByVertex(bookVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(bookVertexType).size()).isEqualTo(1); EVClassMapper bookClassMapper = mapper.getEVClassMappersByVertex(bookVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(bookEntity).size()); - assertEquals(bookClassMapper, mapper.getEVClassMappersByEntity(bookEntity).get(0)); - assertEquals(bookClassMapper.getEntity(), bookEntity); - assertEquals(bookClassMapper.getVertexType(), bookVertexType); - - assertEquals(3, bookClassMapper.getAttribute2property().size()); - assertEquals(3, bookClassMapper.getProperty2attribute().size()); - assertEquals("id", bookClassMapper.getAttribute2property().get("ID")); - assertEquals("title", bookClassMapper.getAttribute2property().get("TITLE")); - assertEquals("authorId", bookClassMapper.getAttribute2property().get("AUTHOR_ID")); - assertEquals("ID", bookClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", bookClassMapper.getProperty2attribute().get("title")); - assertEquals("AUTHOR_ID", bookClassMapper.getProperty2attribute().get("authorId")); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).get(0)).isEqualTo(bookClassMapper); + assertThat(bookEntity).isEqualTo(bookClassMapper.getEntity()); + assertThat(bookVertexType).isEqualTo(bookClassMapper.getVertexType()); + + assertThat(bookClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(bookClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(bookClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(bookClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(bookClassMapper.getAttribute2property().get("AUTHOR_ID")).isEqualTo("authorId"); + assertThat(bookClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(bookClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(bookClassMapper.getProperty2attribute().get("authorId")).isEqualTo("AUTHOR_ID"); Entity bookAuthorEntity = mapper.getDataBaseSchema().getEntityByName("BOOK_AUTHOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(authorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(authorVertexType).size()).isEqualTo(1); EVClassMapper bookAuthorClassMapper = mapper.getEVClassMappersByVertex(authorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(bookAuthorEntity).size()); - assertEquals(bookAuthorClassMapper, mapper.getEVClassMappersByEntity(bookAuthorEntity).get(0)); - assertEquals(bookAuthorClassMapper.getEntity(), bookAuthorEntity); - assertEquals(bookAuthorClassMapper.getVertexType(), authorVertexType); - - assertEquals(3, bookAuthorClassMapper.getAttribute2property().size()); - assertEquals(3, bookAuthorClassMapper.getProperty2attribute().size()); - assertEquals("id", bookAuthorClassMapper.getAttribute2property().get("ID")); - assertEquals("name", bookAuthorClassMapper.getAttribute2property().get("NAME")); - assertEquals("age", bookAuthorClassMapper.getAttribute2property().get("AGE")); - assertEquals("ID", bookAuthorClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", bookAuthorClassMapper.getProperty2attribute().get("name")); - assertEquals("AGE", bookAuthorClassMapper.getProperty2attribute().get("age")); + assertThat(mapper.getEVClassMappersByEntity(bookAuthorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(bookAuthorEntity).get(0)).isEqualTo(bookAuthorClassMapper); + assertThat(bookAuthorEntity).isEqualTo(bookAuthorClassMapper.getEntity()); + assertThat(authorVertexType).isEqualTo(bookAuthorClassMapper.getVertexType()); + + assertThat(bookAuthorClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(bookAuthorClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(bookAuthorClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(bookAuthorClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(bookAuthorClassMapper.getAttribute2property().get("AGE")).isEqualTo("age"); + assertThat(bookAuthorClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(bookAuthorClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(bookAuthorClassMapper.getProperty2attribute().get("age")).isEqualTo("AGE"); // Relationships-Edges Mapping Iterator it = bookEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasAuthorRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(authorEdgeType, mapper.getRelationship2edgeType().get(hasAuthorRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasAuthorRelationship)).isEqualTo(authorEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(authorEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -282,17 +279,17 @@ public void buildGraphModelFromTwoTablesWithOneSimplePK() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Three tables and two relationships with two different simple primary keys imported . */ - public void buildGraphModelFromThreeTablesWithTwoSimplePK() { + @Test + void buildGraphModelFromThreeTablesWithTwoSimplePK() { Connection connection = null; Statement st = null; @@ -323,10 +320,10 @@ public void buildGraphModelFromThreeTablesWithTwoSimplePK() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(2, statistics.totalNumberOfModelEdges); - assertEquals(2, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(2); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(2); /* * Testing built graph model @@ -338,85 +335,85 @@ public void buildGraphModelFromThreeTablesWithTwoSimplePK() { EdgeType bookEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasBook"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(authorVertexType); - assertNotNull(bookVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(authorVertexType).isNotNull(); + assertThat(bookVertexType).isNotNull(); // properties check - assertEquals(3, authorVertexType.getProperties().size()); - - assertNotNull(authorVertexType.getPropertyByName("id")); - assertEquals("id", authorVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, authorVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, authorVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("name")); - assertEquals("name", authorVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, authorVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("age")); - assertEquals("age", authorVertexType.getPropertyByName("age").getName()); - assertEquals("INTEGER", authorVertexType.getPropertyByName("age").getOriginalType()); - assertEquals(3, authorVertexType.getPropertyByName("age").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("age").isFromPrimaryKey()); - - assertEquals(3, bookVertexType.getProperties().size()); - - assertNotNull(bookVertexType.getPropertyByName("id")); - assertEquals("id", bookVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, bookVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, bookVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("title")); - assertEquals("title", bookVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, bookVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("authorId")); - assertEquals("authorId", bookVertexType.getPropertyByName("authorId").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("authorId").getOriginalType()); - assertEquals(3, bookVertexType.getPropertyByName("authorId").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()); - - assertEquals(3, itemVertexType.getProperties().size()); - - assertNotNull(itemVertexType.getPropertyByName("id")); - assertEquals("id", itemVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", itemVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, itemVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, itemVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(itemVertexType.getPropertyByName("bookId")); - assertEquals("bookId", itemVertexType.getPropertyByName("bookId").getName()); - assertEquals("VARCHAR", itemVertexType.getPropertyByName("bookId").getOriginalType()); - assertEquals(2, itemVertexType.getPropertyByName("bookId").getOrdinalPosition()); - assertEquals(false, itemVertexType.getPropertyByName("bookId").isFromPrimaryKey()); - - assertNotNull(itemVertexType.getPropertyByName("price")); - assertEquals("price", itemVertexType.getPropertyByName("price").getName()); - assertEquals("VARCHAR", itemVertexType.getPropertyByName("price").getOriginalType()); - assertEquals(3, itemVertexType.getPropertyByName("price").getOrdinalPosition()); - assertEquals(false, itemVertexType.getPropertyByName("price").isFromPrimaryKey()); + assertThat(authorVertexType.getProperties().size()).isEqualTo(3); + + assertThat(authorVertexType.getPropertyByName("id")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(authorVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(authorVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(authorVertexType.getPropertyByName("name")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(authorVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(authorVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(authorVertexType.getPropertyByName("age")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("age").getName()).isEqualTo("age"); + assertThat(authorVertexType.getPropertyByName("age").getOriginalType()).isEqualTo("INTEGER"); + assertThat(authorVertexType.getPropertyByName("age").getOrdinalPosition()).isEqualTo(3); + assertThat(authorVertexType.getPropertyByName("age").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getProperties().size()).isEqualTo(3); + + assertThat(bookVertexType.getPropertyByName("id")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(bookVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(bookVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(bookVertexType.getPropertyByName("title")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(bookVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(bookVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getPropertyByName("authorId")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("authorId").getName()).isEqualTo("authorId"); + assertThat(bookVertexType.getPropertyByName("authorId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("authorId").getOrdinalPosition()).isEqualTo(3); + assertThat(bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()).isFalse(); + + assertThat(itemVertexType.getProperties().size()).isEqualTo(3); + + assertThat(itemVertexType.getPropertyByName("id")).isNotNull(); + assertThat(itemVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(itemVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(itemVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(itemVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(itemVertexType.getPropertyByName("bookId")).isNotNull(); + assertThat(itemVertexType.getPropertyByName("bookId").getName()).isEqualTo("bookId"); + assertThat(itemVertexType.getPropertyByName("bookId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(itemVertexType.getPropertyByName("bookId").getOrdinalPosition()).isEqualTo(2); + assertThat(itemVertexType.getPropertyByName("bookId").isFromPrimaryKey()).isFalse(); + + assertThat(itemVertexType.getPropertyByName("price")).isNotNull(); + assertThat(itemVertexType.getPropertyByName("price").getName()).isEqualTo("price"); + assertThat(itemVertexType.getPropertyByName("price").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(itemVertexType.getPropertyByName("price").getOrdinalPosition()).isEqualTo(3); + assertThat(itemVertexType.getPropertyByName("price").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(2, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(authorEdgeType); - assertNotNull(bookEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(2); + assertThat(authorEdgeType).isNotNull(); + assertThat(bookEdgeType).isNotNull(); - assertEquals("HasAuthor", authorEdgeType.getName()); - assertEquals(0, authorEdgeType.getProperties().size()); - assertEquals("Author", authorEdgeType.getInVertexType().getName()); - assertEquals(1, authorEdgeType.getNumberRelationshipsRepresented()); + assertThat(authorEdgeType.getName()).isEqualTo("HasAuthor"); + assertThat(authorEdgeType.getProperties().size()).isEqualTo(0); + assertThat(authorEdgeType.getInVertexType().getName()).isEqualTo("Author"); + assertThat(authorEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); - assertEquals("HasBook", bookEdgeType.getName()); - assertEquals(0, bookEdgeType.getProperties().size()); - assertEquals("Book", bookEdgeType.getInVertexType().getName()); - assertEquals(1, bookEdgeType.getNumberRelationshipsRepresented()); + assertThat(bookEdgeType.getName()).isEqualTo("HasBook"); + assertThat(bookEdgeType.getProperties().size()).isEqualTo(0); + assertThat(bookEdgeType.getInVertexType().getName()).isEqualTo("Book"); + assertThat(bookEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); /* * Rules check @@ -424,85 +421,85 @@ public void buildGraphModelFromThreeTablesWithTwoSimplePK() { // Classes Mapping - assertEquals(3, mapper.getVertexType2EVClassMappers().size()); - assertEquals(3, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(3); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(3); Entity bookEntity = mapper.getDataBaseSchema().getEntityByName("BOOK"); - assertEquals(1, mapper.getEVClassMappersByVertex(bookVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(bookVertexType).size()).isEqualTo(1); EVClassMapper bookClassMapper = mapper.getEVClassMappersByVertex(bookVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(bookEntity).size()); - assertEquals(bookClassMapper, mapper.getEVClassMappersByEntity(bookEntity).get(0)); - assertEquals(bookClassMapper.getEntity(), bookEntity); - assertEquals(bookClassMapper.getVertexType(), bookVertexType); - - assertEquals(3, bookClassMapper.getAttribute2property().size()); - assertEquals(3, bookClassMapper.getProperty2attribute().size()); - assertEquals("id", bookClassMapper.getAttribute2property().get("ID")); - assertEquals("title", bookClassMapper.getAttribute2property().get("TITLE")); - assertEquals("authorId", bookClassMapper.getAttribute2property().get("AUTHOR_ID")); - assertEquals("ID", bookClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", bookClassMapper.getProperty2attribute().get("title")); - assertEquals("AUTHOR_ID", bookClassMapper.getProperty2attribute().get("authorId")); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).get(0)).isEqualTo(bookClassMapper); + assertThat(bookEntity).isEqualTo(bookClassMapper.getEntity()); + assertThat(bookVertexType).isEqualTo(bookClassMapper.getVertexType()); + + assertThat(bookClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(bookClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(bookClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(bookClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(bookClassMapper.getAttribute2property().get("AUTHOR_ID")).isEqualTo("authorId"); + assertThat(bookClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(bookClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(bookClassMapper.getProperty2attribute().get("authorId")).isEqualTo("AUTHOR_ID"); Entity authorEntity = mapper.getDataBaseSchema().getEntityByName("AUTHOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(authorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(authorVertexType).size()).isEqualTo(1); EVClassMapper authorClassMapper = mapper.getEVClassMappersByVertex(authorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(authorEntity).size()); - assertEquals(authorClassMapper, mapper.getEVClassMappersByEntity(authorEntity).get(0)); - assertEquals(authorClassMapper.getEntity(), authorEntity); - assertEquals(authorClassMapper.getVertexType(), authorVertexType); - - assertEquals(3, authorClassMapper.getAttribute2property().size()); - assertEquals(3, authorClassMapper.getProperty2attribute().size()); - assertEquals("id", authorClassMapper.getAttribute2property().get("ID")); - assertEquals("name", authorClassMapper.getAttribute2property().get("NAME")); - assertEquals("age", authorClassMapper.getAttribute2property().get("AGE")); - assertEquals("ID", authorClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", authorClassMapper.getProperty2attribute().get("name")); - assertEquals("AGE", authorClassMapper.getProperty2attribute().get("age")); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).get(0)).isEqualTo(authorClassMapper); + assertThat(authorEntity).isEqualTo(authorClassMapper.getEntity()); + assertThat(authorVertexType).isEqualTo(authorClassMapper.getVertexType()); + + assertThat(authorClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(authorClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(authorClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(authorClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(authorClassMapper.getAttribute2property().get("AGE")).isEqualTo("age"); + assertThat(authorClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(authorClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(authorClassMapper.getProperty2attribute().get("age")).isEqualTo("AGE"); Entity itemEntity = mapper.getDataBaseSchema().getEntityByName("ITEM"); - assertEquals(1, mapper.getEVClassMappersByVertex(itemVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(itemVertexType).size()).isEqualTo(1); EVClassMapper itemClassMapper = mapper.getEVClassMappersByVertex(itemVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(itemEntity).size()); - assertEquals(itemClassMapper, mapper.getEVClassMappersByEntity(itemEntity).get(0)); - assertEquals(itemClassMapper.getEntity(), itemEntity); - assertEquals(itemClassMapper.getVertexType(), itemVertexType); - - assertEquals(3, itemClassMapper.getAttribute2property().size()); - assertEquals(3, itemClassMapper.getProperty2attribute().size()); - assertEquals("id", itemClassMapper.getAttribute2property().get("ID")); - assertEquals("bookId", itemClassMapper.getAttribute2property().get("BOOK_ID")); - assertEquals("price", itemClassMapper.getAttribute2property().get("PRICE")); - assertEquals("ID", itemClassMapper.getProperty2attribute().get("id")); - assertEquals("BOOK_ID", itemClassMapper.getProperty2attribute().get("bookId")); - assertEquals("PRICE", itemClassMapper.getProperty2attribute().get("price")); + assertThat(mapper.getEVClassMappersByEntity(itemEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(itemEntity).get(0)).isEqualTo(itemClassMapper); + assertThat(itemEntity).isEqualTo(itemClassMapper.getEntity()); + assertThat(itemVertexType).isEqualTo(itemClassMapper.getVertexType()); + + assertThat(itemClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(itemClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(itemClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(itemClassMapper.getAttribute2property().get("BOOK_ID")).isEqualTo("bookId"); + assertThat(itemClassMapper.getAttribute2property().get("PRICE")).isEqualTo("price"); + assertThat(itemClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(itemClassMapper.getProperty2attribute().get("bookId")).isEqualTo("BOOK_ID"); + assertThat(itemClassMapper.getProperty2attribute().get("price")).isEqualTo("PRICE"); // Relationships-Edges Mapping Iterator it = bookEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasAuthorRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = itemEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasBookRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, mapper.getRelationship2edgeType().size()); - assertEquals(authorEdgeType, mapper.getRelationship2edgeType().get(hasAuthorRelationship)); - assertEquals(bookEdgeType, mapper.getRelationship2edgeType().get(hasBookRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(2); + assertThat(mapper.getRelationship2edgeType().get(hasAuthorRelationship)).isEqualTo(authorEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasBookRelationship)).isEqualTo(bookEdgeType); - assertEquals(2, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(authorEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)); - assertEquals(1, mapper.getEdgeType2relationships().get(bookEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(bookEdgeType).contains(hasBookRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(bookEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(bookEdgeType).contains(hasBookRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -511,17 +508,17 @@ public void buildGraphModelFromThreeTablesWithTwoSimplePK() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Three tables and two relationships with a simple primary keys twice imported. */ - public void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { + @Test + void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { Connection connection = null; Statement st = null; @@ -552,10 +549,10 @@ public void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built graph model @@ -566,85 +563,85 @@ public void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { EdgeType authorEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasAuthor"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(authorVertexType); - assertNotNull(bookVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(authorVertexType).isNotNull(); + assertThat(bookVertexType).isNotNull(); // properties check - assertEquals(3, authorVertexType.getProperties().size()); - - assertNotNull(authorVertexType.getPropertyByName("id")); - assertEquals("id", authorVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, authorVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, authorVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("name")); - assertEquals("name", authorVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, authorVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("age")); - assertEquals("age", authorVertexType.getPropertyByName("age").getName()); - assertEquals("INTEGER", authorVertexType.getPropertyByName("age").getOriginalType()); - assertEquals(3, authorVertexType.getPropertyByName("age").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("age").isFromPrimaryKey()); - - assertEquals(3, bookVertexType.getProperties().size()); - - assertNotNull(bookVertexType.getPropertyByName("id")); - assertEquals("id", bookVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, bookVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, bookVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("title")); - assertEquals("title", bookVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, bookVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("authorId")); - assertEquals("authorId", bookVertexType.getPropertyByName("authorId").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("authorId").getOriginalType()); - assertEquals(3, bookVertexType.getPropertyByName("authorId").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()); - - assertEquals(4, articleVertexType.getProperties().size()); - - assertNotNull(articleVertexType.getPropertyByName("id")); - assertEquals("id", articleVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", articleVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, articleVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, articleVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(articleVertexType.getPropertyByName("title")); - assertEquals("title", articleVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", articleVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, articleVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, articleVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(articleVertexType.getPropertyByName("date")); - assertEquals("date", articleVertexType.getPropertyByName("date").getName()); - assertEquals("DATE", articleVertexType.getPropertyByName("date").getOriginalType()); - assertEquals(3, articleVertexType.getPropertyByName("date").getOrdinalPosition()); - assertEquals(false, articleVertexType.getPropertyByName("date").isFromPrimaryKey()); - - assertNotNull(articleVertexType.getPropertyByName("authorId")); - assertEquals("authorId", articleVertexType.getPropertyByName("authorId").getName()); - assertEquals("VARCHAR", articleVertexType.getPropertyByName("authorId").getOriginalType()); - assertEquals(4, articleVertexType.getPropertyByName("authorId").getOrdinalPosition()); - assertEquals(false, articleVertexType.getPropertyByName("authorId").isFromPrimaryKey()); + assertThat(authorVertexType.getProperties().size()).isEqualTo(3); + + assertThat(authorVertexType.getPropertyByName("id")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(authorVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(authorVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(authorVertexType.getPropertyByName("name")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(authorVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(authorVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(authorVertexType.getPropertyByName("age")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("age").getName()).isEqualTo("age"); + assertThat(authorVertexType.getPropertyByName("age").getOriginalType()).isEqualTo("INTEGER"); + assertThat(authorVertexType.getPropertyByName("age").getOrdinalPosition()).isEqualTo(3); + assertThat(authorVertexType.getPropertyByName("age").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getProperties().size()).isEqualTo(3); + + assertThat(bookVertexType.getPropertyByName("id")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(bookVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(bookVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(bookVertexType.getPropertyByName("title")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(bookVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(bookVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getPropertyByName("authorId")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("authorId").getName()).isEqualTo("authorId"); + assertThat(bookVertexType.getPropertyByName("authorId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("authorId").getOrdinalPosition()).isEqualTo(3); + assertThat(bookVertexType.getPropertyByName("authorId").isFromPrimaryKey()).isFalse(); + + assertThat(articleVertexType.getProperties().size()).isEqualTo(4); + + assertThat(articleVertexType.getPropertyByName("id")).isNotNull(); + assertThat(articleVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(articleVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(articleVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(articleVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(articleVertexType.getPropertyByName("title")).isNotNull(); + assertThat(articleVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(articleVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(articleVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(articleVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(articleVertexType.getPropertyByName("date")).isNotNull(); + assertThat(articleVertexType.getPropertyByName("date").getName()).isEqualTo("date"); + assertThat(articleVertexType.getPropertyByName("date").getOriginalType()).isEqualTo("DATE"); + assertThat(articleVertexType.getPropertyByName("date").getOrdinalPosition()).isEqualTo(3); + assertThat(articleVertexType.getPropertyByName("date").isFromPrimaryKey()).isFalse(); + + assertThat(articleVertexType.getPropertyByName("authorId")).isNotNull(); + assertThat(articleVertexType.getPropertyByName("authorId").getName()).isEqualTo("authorId"); + assertThat(articleVertexType.getPropertyByName("authorId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(articleVertexType.getPropertyByName("authorId").getOrdinalPosition()).isEqualTo(4); + assertThat(articleVertexType.getPropertyByName("authorId").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(authorEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(authorEdgeType).isNotNull(); - assertEquals("HasAuthor", authorEdgeType.getName()); - assertEquals(0, authorEdgeType.getProperties().size()); - assertEquals("Author", authorEdgeType.getInVertexType().getName()); - assertEquals(2, authorEdgeType.getNumberRelationshipsRepresented()); + assertThat(authorEdgeType.getName()).isEqualTo("HasAuthor"); + assertThat(authorEdgeType.getProperties().size()).isEqualTo(0); + assertThat(authorEdgeType.getInVertexType().getName()).isEqualTo("Author"); + assertThat(authorEdgeType.getNumberRelationshipsRepresented()).isEqualTo(2); /* * Rules check @@ -652,86 +649,86 @@ public void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { // Classes Mapping - assertEquals(3, mapper.getVertexType2EVClassMappers().size()); - assertEquals(3, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(3); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(3); Entity bookEntity = mapper.getDataBaseSchema().getEntityByName("BOOK"); - assertEquals(1, mapper.getEVClassMappersByVertex(bookVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(bookVertexType).size()).isEqualTo(1); EVClassMapper bookClassMapper = mapper.getEVClassMappersByVertex(bookVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(bookEntity).size()); - assertEquals(bookClassMapper, mapper.getEVClassMappersByEntity(bookEntity).get(0)); - assertEquals(bookClassMapper.getEntity(), bookEntity); - assertEquals(bookClassMapper.getVertexType(), bookVertexType); - - assertEquals(3, bookClassMapper.getAttribute2property().size()); - assertEquals(3, bookClassMapper.getProperty2attribute().size()); - assertEquals("id", bookClassMapper.getAttribute2property().get("ID")); - assertEquals("title", bookClassMapper.getAttribute2property().get("TITLE")); - assertEquals("authorId", bookClassMapper.getAttribute2property().get("AUTHOR_ID")); - assertEquals("ID", bookClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", bookClassMapper.getProperty2attribute().get("title")); - assertEquals("AUTHOR_ID", bookClassMapper.getProperty2attribute().get("authorId")); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).get(0)).isEqualTo(bookClassMapper); + assertThat(bookEntity).isEqualTo(bookClassMapper.getEntity()); + assertThat(bookVertexType).isEqualTo(bookClassMapper.getVertexType()); + + assertThat(bookClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(bookClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(bookClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(bookClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(bookClassMapper.getAttribute2property().get("AUTHOR_ID")).isEqualTo("authorId"); + assertThat(bookClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(bookClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(bookClassMapper.getProperty2attribute().get("authorId")).isEqualTo("AUTHOR_ID"); Entity authorEntity = mapper.getDataBaseSchema().getEntityByName("AUTHOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(authorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(authorVertexType).size()).isEqualTo(1); EVClassMapper authorClassMapper = mapper.getEVClassMappersByVertex(authorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(authorEntity).size()); - assertEquals(authorClassMapper, mapper.getEVClassMappersByEntity(authorEntity).get(0)); - assertEquals(authorClassMapper.getEntity(), authorEntity); - assertEquals(authorClassMapper.getVertexType(), authorVertexType); - - assertEquals(3, authorClassMapper.getAttribute2property().size()); - assertEquals(3, authorClassMapper.getProperty2attribute().size()); - assertEquals("id", authorClassMapper.getAttribute2property().get("ID")); - assertEquals("name", authorClassMapper.getAttribute2property().get("NAME")); - assertEquals("age", authorClassMapper.getAttribute2property().get("AGE")); - assertEquals("ID", authorClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", authorClassMapper.getProperty2attribute().get("name")); - assertEquals("AGE", authorClassMapper.getProperty2attribute().get("age")); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).get(0)).isEqualTo(authorClassMapper); + assertThat(authorEntity).isEqualTo(authorClassMapper.getEntity()); + assertThat(authorVertexType).isEqualTo(authorClassMapper.getVertexType()); + + assertThat(authorClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(authorClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(authorClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(authorClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(authorClassMapper.getAttribute2property().get("AGE")).isEqualTo("age"); + assertThat(authorClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(authorClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(authorClassMapper.getProperty2attribute().get("age")).isEqualTo("AGE"); Entity articleEntity = mapper.getDataBaseSchema().getEntityByName("ARTICLE"); - assertEquals(1, mapper.getEVClassMappersByVertex(articleVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(articleVertexType).size()).isEqualTo(1); EVClassMapper articleClassMapper = mapper.getEVClassMappersByVertex(articleVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(articleEntity).size()); - assertEquals(articleClassMapper, mapper.getEVClassMappersByEntity(articleEntity).get(0)); - assertEquals(articleClassMapper.getEntity(), articleEntity); - assertEquals(articleClassMapper.getVertexType(), articleVertexType); - - assertEquals(4, articleClassMapper.getAttribute2property().size()); - assertEquals(4, articleClassMapper.getProperty2attribute().size()); - assertEquals("id", articleClassMapper.getAttribute2property().get("ID")); - assertEquals("title", articleClassMapper.getAttribute2property().get("TITLE")); - assertEquals("date", articleClassMapper.getAttribute2property().get("DATE")); - assertEquals("authorId", articleClassMapper.getAttribute2property().get("AUTHOR_ID")); - assertEquals("ID", articleClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", articleClassMapper.getProperty2attribute().get("title")); - assertEquals("DATE", articleClassMapper.getProperty2attribute().get("date")); - assertEquals("AUTHOR_ID", articleClassMapper.getProperty2attribute().get("authorId")); + assertThat(mapper.getEVClassMappersByEntity(articleEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(articleEntity).get(0)).isEqualTo(articleClassMapper); + assertThat(articleEntity).isEqualTo(articleClassMapper.getEntity()); + assertThat(articleVertexType).isEqualTo(articleClassMapper.getVertexType()); + + assertThat(articleClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(articleClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(articleClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(articleClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(articleClassMapper.getAttribute2property().get("DATE")).isEqualTo("date"); + assertThat(articleClassMapper.getAttribute2property().get("AUTHOR_ID")).isEqualTo("authorId"); + assertThat(articleClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(articleClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(articleClassMapper.getProperty2attribute().get("date")).isEqualTo("DATE"); + assertThat(articleClassMapper.getProperty2attribute().get("authorId")).isEqualTo("AUTHOR_ID"); // Relationships-Edges Mapping Iterator it = bookEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasAuthorRelationship1 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = articleEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasAuthorRelationship2 = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, mapper.getRelationship2edgeType().size()); - assertEquals(authorEdgeType, mapper.getRelationship2edgeType().get(hasAuthorRelationship1)); - assertEquals(authorEdgeType, mapper.getRelationship2edgeType().get(hasAuthorRelationship2)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(2); + assertThat(mapper.getRelationship2edgeType().get(hasAuthorRelationship1)).isEqualTo(authorEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasAuthorRelationship2)).isEqualTo(authorEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(2, mapper.getEdgeType2relationships().get(authorEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship1)); - assertTrue(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship2)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship1)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship2)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -740,17 +737,17 @@ public void buildGraphModelFromThreeTablesWithOneSimplePKImportedTwice() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two tables Foreign and Parent with a composite primary key imported from the parent table. */ - public void buildGraphModelFromThreeTablesWithOneCompositePK() { + @Test + void buildGraphModelFromThreeTablesWithOneCompositePK() { Connection connection = null; Statement st = null; @@ -777,10 +774,10 @@ public void buildGraphModelFromThreeTablesWithOneCompositePK() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfModelVertices); - assertEquals(2, statistics.builtModelVertexTypes); - assertEquals(1, statistics.totalNumberOfModelEdges); - assertEquals(1, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(2); + assertThat(statistics.builtModelVertexTypes).isEqualTo(2); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(1); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(1); /* * Testing built graph model @@ -790,65 +787,65 @@ public void buildGraphModelFromThreeTablesWithOneCompositePK() { EdgeType authorEdgeType = mapper.getGraphModel().getEdgeTypeByName("Book2Author"); // vertices check - assertEquals(2, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(authorVertexType); - assertNotNull(bookVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(2); + assertThat(authorVertexType).isNotNull(); + assertThat(bookVertexType).isNotNull(); // properties check - assertEquals(3, authorVertexType.getProperties().size()); - - assertNotNull(authorVertexType.getPropertyByName("name")); - assertEquals("name", authorVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(1, authorVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(true, authorVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("surname")); - assertEquals("surname", authorVertexType.getPropertyByName("surname").getName()); - assertEquals("VARCHAR", authorVertexType.getPropertyByName("surname").getOriginalType()); - assertEquals(2, authorVertexType.getPropertyByName("surname").getOrdinalPosition()); - assertEquals(true, authorVertexType.getPropertyByName("surname").isFromPrimaryKey()); - - assertNotNull(authorVertexType.getPropertyByName("age")); - assertEquals("age", authorVertexType.getPropertyByName("age").getName()); - assertEquals("INTEGER", authorVertexType.getPropertyByName("age").getOriginalType()); - assertEquals(3, authorVertexType.getPropertyByName("age").getOrdinalPosition()); - assertEquals(false, authorVertexType.getPropertyByName("age").isFromPrimaryKey()); - - assertEquals(4, bookVertexType.getProperties().size()); - - assertNotNull(bookVertexType.getPropertyByName("id")); - assertEquals("id", bookVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, bookVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, bookVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("title")); - assertEquals("title", bookVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, bookVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("authorName")); - assertEquals("authorName", bookVertexType.getPropertyByName("authorName").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("authorName").getOriginalType()); - assertEquals(3, bookVertexType.getPropertyByName("authorName").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("authorName").isFromPrimaryKey()); - - assertNotNull(bookVertexType.getPropertyByName("authorSurname")); - assertEquals("authorSurname", bookVertexType.getPropertyByName("authorSurname").getName()); - assertEquals("VARCHAR", bookVertexType.getPropertyByName("authorSurname").getOriginalType()); - assertEquals(4, bookVertexType.getPropertyByName("authorSurname").getOrdinalPosition()); - assertEquals(false, bookVertexType.getPropertyByName("authorSurname").isFromPrimaryKey()); + assertThat(authorVertexType.getProperties().size()).isEqualTo(3); + + assertThat(authorVertexType.getPropertyByName("name")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(authorVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(1); + assertThat(authorVertexType.getPropertyByName("name").isFromPrimaryKey()).isTrue(); + + assertThat(authorVertexType.getPropertyByName("surname")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("surname").getName()).isEqualTo("surname"); + assertThat(authorVertexType.getPropertyByName("surname").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(authorVertexType.getPropertyByName("surname").getOrdinalPosition()).isEqualTo(2); + assertThat(authorVertexType.getPropertyByName("surname").isFromPrimaryKey()).isTrue(); + + assertThat(authorVertexType.getPropertyByName("age")).isNotNull(); + assertThat(authorVertexType.getPropertyByName("age").getName()).isEqualTo("age"); + assertThat(authorVertexType.getPropertyByName("age").getOriginalType()).isEqualTo("INTEGER"); + assertThat(authorVertexType.getPropertyByName("age").getOrdinalPosition()).isEqualTo(3); + assertThat(authorVertexType.getPropertyByName("age").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getProperties().size()).isEqualTo(4); + + assertThat(bookVertexType.getPropertyByName("id")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(bookVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(bookVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(bookVertexType.getPropertyByName("title")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(bookVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(bookVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getPropertyByName("authorName")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("authorName").getName()).isEqualTo("authorName"); + assertThat(bookVertexType.getPropertyByName("authorName").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("authorName").getOrdinalPosition()).isEqualTo(3); + assertThat(bookVertexType.getPropertyByName("authorName").isFromPrimaryKey()).isFalse(); + + assertThat(bookVertexType.getPropertyByName("authorSurname")).isNotNull(); + assertThat(bookVertexType.getPropertyByName("authorSurname").getName()).isEqualTo("authorSurname"); + assertThat(bookVertexType.getPropertyByName("authorSurname").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(bookVertexType.getPropertyByName("authorSurname").getOrdinalPosition()).isEqualTo(4); + assertThat(bookVertexType.getPropertyByName("authorSurname").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(1, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(authorEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(1); + assertThat(authorEdgeType).isNotNull(); - assertEquals("Book2Author", authorEdgeType.getName()); - assertEquals(0, authorEdgeType.getProperties().size()); - assertEquals("Author", authorEdgeType.getInVertexType().getName()); - assertEquals(1, authorEdgeType.getNumberRelationshipsRepresented()); + assertThat(authorEdgeType.getName()).isEqualTo("Book2Author"); + assertThat(authorEdgeType.getProperties().size()).isEqualTo(0); + assertThat(authorEdgeType.getInVertexType().getName()).isEqualTo("Author"); + assertThat(authorEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); /* * Rules check @@ -856,64 +853,64 @@ public void buildGraphModelFromThreeTablesWithOneCompositePK() { // Classes Mapping - assertEquals(2, mapper.getVertexType2EVClassMappers().size()); - assertEquals(2, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(2); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(2); Entity bookEntity = mapper.getDataBaseSchema().getEntityByName("BOOK"); - assertEquals(1, mapper.getEVClassMappersByVertex(bookVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(bookVertexType).size()).isEqualTo(1); EVClassMapper bookClassMapper = mapper.getEVClassMappersByVertex(bookVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(bookEntity).size()); - assertEquals(bookClassMapper, mapper.getEVClassMappersByEntity(bookEntity).get(0)); - assertEquals(bookClassMapper.getEntity(), bookEntity); - assertEquals(bookClassMapper.getVertexType(), bookVertexType); - - assertEquals(4, bookClassMapper.getAttribute2property().size()); - assertEquals(4, bookClassMapper.getProperty2attribute().size()); - assertEquals("id", bookClassMapper.getAttribute2property().get("ID")); - assertEquals("title", bookClassMapper.getAttribute2property().get("TITLE")); - assertEquals("authorName", bookClassMapper.getAttribute2property().get("AUTHOR_NAME")); - assertEquals("authorSurname", bookClassMapper.getAttribute2property().get("AUTHOR_SURNAME")); - assertEquals("ID", bookClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", bookClassMapper.getProperty2attribute().get("title")); - assertEquals("AUTHOR_NAME", bookClassMapper.getProperty2attribute().get("authorName")); - assertEquals("AUTHOR_SURNAME", bookClassMapper.getProperty2attribute().get("authorSurname")); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(bookEntity).get(0)).isEqualTo(bookClassMapper); + assertThat(bookEntity).isEqualTo(bookClassMapper.getEntity()); + assertThat(bookVertexType).isEqualTo(bookClassMapper.getVertexType()); + + assertThat(bookClassMapper.getAttribute2property().size()).isEqualTo(4); + assertThat(bookClassMapper.getProperty2attribute().size()).isEqualTo(4); + assertThat(bookClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(bookClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(bookClassMapper.getAttribute2property().get("AUTHOR_NAME")).isEqualTo("authorName"); + assertThat(bookClassMapper.getAttribute2property().get("AUTHOR_SURNAME")).isEqualTo("authorSurname"); + assertThat(bookClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(bookClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(bookClassMapper.getProperty2attribute().get("authorName")).isEqualTo("AUTHOR_NAME"); + assertThat(bookClassMapper.getProperty2attribute().get("authorSurname")).isEqualTo("AUTHOR_SURNAME"); Entity authorEntity = mapper.getDataBaseSchema().getEntityByName("AUTHOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(authorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(authorVertexType).size()).isEqualTo(1); EVClassMapper authorClassMapper = mapper.getEVClassMappersByVertex(authorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(authorEntity).size()); - assertEquals(authorClassMapper, mapper.getEVClassMappersByEntity(authorEntity).get(0)); - assertEquals(authorClassMapper.getEntity(), authorEntity); - assertEquals(authorClassMapper.getVertexType(), authorVertexType); - - assertEquals(3, authorClassMapper.getAttribute2property().size()); - assertEquals(3, authorClassMapper.getProperty2attribute().size()); - assertEquals("name", authorClassMapper.getAttribute2property().get("NAME")); - assertEquals("surname", authorClassMapper.getAttribute2property().get("SURNAME")); - assertEquals("age", authorClassMapper.getAttribute2property().get("AGE")); - assertEquals("NAME", authorClassMapper.getProperty2attribute().get("name")); - assertEquals("SURNAME", authorClassMapper.getProperty2attribute().get("surname")); - assertEquals("AGE", authorClassMapper.getProperty2attribute().get("age")); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(authorEntity).get(0)).isEqualTo(authorClassMapper); + assertThat(authorEntity).isEqualTo(authorClassMapper.getEntity()); + assertThat(authorVertexType).isEqualTo(authorClassMapper.getVertexType()); + + assertThat(authorClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(authorClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(authorClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(authorClassMapper.getAttribute2property().get("SURNAME")).isEqualTo("surname"); + assertThat(authorClassMapper.getAttribute2property().get("AGE")).isEqualTo("age"); + assertThat(authorClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(authorClassMapper.getProperty2attribute().get("surname")).isEqualTo("SURNAME"); + assertThat(authorClassMapper.getProperty2attribute().get("age")).isEqualTo("AGE"); // Relationships-Edges Mapping Iterator it = bookEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasAuthorRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(1, mapper.getRelationship2edgeType().size()); - assertEquals(authorEdgeType, mapper.getRelationship2edgeType().get(hasAuthorRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(1); + assertThat(mapper.getRelationship2edgeType().get(hasAuthorRelationship)).isEqualTo(authorEdgeType); - assertEquals(1, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(authorEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(authorEdgeType).contains(hasAuthorRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -922,17 +919,17 @@ public void buildGraphModelFromThreeTablesWithOneCompositePK() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Three tables: 2 Parent and 1 join table which imports two different simple primary key. */ - public void buildGraphModelFromJoinTableAnd2ParentTables() { + @Test + void buildGraphModelFromJoinTableAnd2ParentTables() { Connection connection = null; Statement st = null; @@ -963,10 +960,10 @@ public void buildGraphModelFromJoinTableAnd2ParentTables() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfModelVertices); - assertEquals(3, statistics.builtModelVertexTypes); - assertEquals(2, statistics.totalNumberOfModelEdges); - assertEquals(2, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(3); + assertThat(statistics.builtModelVertexTypes).isEqualTo(3); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(2); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(2); /* * Testing built graph model @@ -978,80 +975,80 @@ public void buildGraphModelFromJoinTableAnd2ParentTables() { EdgeType filmEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasFilm"); // vertices check - assertEquals(3, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(actorVertexType); - assertNotNull(filmVertexType); - assertNotNull(film2actorVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(3); + assertThat(actorVertexType).isNotNull(); + assertThat(filmVertexType).isNotNull(); + assertThat(film2actorVertexType).isNotNull(); // properties check - assertEquals(3, actorVertexType.getProperties().size()); - - assertNotNull(actorVertexType.getPropertyByName("id")); - assertEquals("id", actorVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", actorVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, actorVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, actorVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(actorVertexType.getPropertyByName("name")); - assertEquals("name", actorVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", actorVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(2, actorVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, actorVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertNotNull(actorVertexType.getPropertyByName("surname")); - assertEquals("surname", actorVertexType.getPropertyByName("surname").getName()); - assertEquals("VARCHAR", actorVertexType.getPropertyByName("surname").getOriginalType()); - assertEquals(3, actorVertexType.getPropertyByName("surname").getOrdinalPosition()); - assertEquals(false, actorVertexType.getPropertyByName("surname").isFromPrimaryKey()); - - assertEquals(3, filmVertexType.getProperties().size()); - - assertNotNull(filmVertexType.getPropertyByName("id")); - assertEquals("id", filmVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", filmVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, filmVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, filmVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(filmVertexType.getPropertyByName("title")); - assertEquals("title", filmVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", filmVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, filmVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, filmVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(filmVertexType.getPropertyByName("year")); - assertEquals("year", filmVertexType.getPropertyByName("year").getName()); - assertEquals("DATE", filmVertexType.getPropertyByName("year").getOriginalType()); - assertEquals(3, filmVertexType.getPropertyByName("year").getOrdinalPosition()); - assertEquals(false, filmVertexType.getPropertyByName("year").isFromPrimaryKey()); - - assertEquals(2, film2actorVertexType.getProperties().size()); - - assertNotNull(film2actorVertexType.getPropertyByName("filmId")); - assertEquals("filmId", film2actorVertexType.getPropertyByName("filmId").getName()); - assertEquals("VARCHAR", film2actorVertexType.getPropertyByName("filmId").getOriginalType()); - assertEquals(1, film2actorVertexType.getPropertyByName("filmId").getOrdinalPosition()); - assertEquals(true, film2actorVertexType.getPropertyByName("filmId").isFromPrimaryKey()); - - assertNotNull(film2actorVertexType.getPropertyByName("actorId")); - assertEquals("actorId", film2actorVertexType.getPropertyByName("actorId").getName()); - assertEquals("VARCHAR", film2actorVertexType.getPropertyByName("actorId").getOriginalType()); - assertEquals(2, film2actorVertexType.getPropertyByName("actorId").getOrdinalPosition()); - assertEquals(true, film2actorVertexType.getPropertyByName("actorId").isFromPrimaryKey()); + assertThat(actorVertexType.getProperties().size()).isEqualTo(3); + + assertThat(actorVertexType.getPropertyByName("id")).isNotNull(); + assertThat(actorVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(actorVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(actorVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(actorVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(actorVertexType.getPropertyByName("name")).isNotNull(); + assertThat(actorVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(actorVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(actorVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(2); + assertThat(actorVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(actorVertexType.getPropertyByName("surname")).isNotNull(); + assertThat(actorVertexType.getPropertyByName("surname").getName()).isEqualTo("surname"); + assertThat(actorVertexType.getPropertyByName("surname").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(actorVertexType.getPropertyByName("surname").getOrdinalPosition()).isEqualTo(3); + assertThat(actorVertexType.getPropertyByName("surname").isFromPrimaryKey()).isFalse(); + + assertThat(filmVertexType.getProperties().size()).isEqualTo(3); + + assertThat(filmVertexType.getPropertyByName("id")).isNotNull(); + assertThat(filmVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(filmVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(filmVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(filmVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(filmVertexType.getPropertyByName("title")).isNotNull(); + assertThat(filmVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(filmVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(filmVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(filmVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(filmVertexType.getPropertyByName("year")).isNotNull(); + assertThat(filmVertexType.getPropertyByName("year").getName()).isEqualTo("year"); + assertThat(filmVertexType.getPropertyByName("year").getOriginalType()).isEqualTo("DATE"); + assertThat(filmVertexType.getPropertyByName("year").getOrdinalPosition()).isEqualTo(3); + assertThat(filmVertexType.getPropertyByName("year").isFromPrimaryKey()).isFalse(); + + assertThat(film2actorVertexType.getProperties().size()).isEqualTo(2); + + assertThat(film2actorVertexType.getPropertyByName("filmId")).isNotNull(); + assertThat(film2actorVertexType.getPropertyByName("filmId").getName()).isEqualTo("filmId"); + assertThat(film2actorVertexType.getPropertyByName("filmId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(film2actorVertexType.getPropertyByName("filmId").getOrdinalPosition()).isEqualTo(1); + assertThat(film2actorVertexType.getPropertyByName("filmId").isFromPrimaryKey()).isTrue(); + + assertThat(film2actorVertexType.getPropertyByName("actorId")).isNotNull(); + assertThat(film2actorVertexType.getPropertyByName("actorId").getName()).isEqualTo("actorId"); + assertThat(film2actorVertexType.getPropertyByName("actorId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(film2actorVertexType.getPropertyByName("actorId").getOrdinalPosition()).isEqualTo(2); + assertThat(film2actorVertexType.getPropertyByName("actorId").isFromPrimaryKey()).isTrue(); // edges check - assertEquals(2, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(filmEdgeType); - assertNotNull(actorEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(2); + assertThat(filmEdgeType).isNotNull(); + assertThat(actorEdgeType).isNotNull(); - assertEquals("HasFilm", filmEdgeType.getName()); - assertEquals(0, filmEdgeType.getProperties().size()); - assertEquals("Film", filmEdgeType.getInVertexType().getName()); - assertEquals(1, filmEdgeType.getNumberRelationshipsRepresented()); + assertThat(filmEdgeType.getName()).isEqualTo("HasFilm"); + assertThat(filmEdgeType.getProperties().size()).isEqualTo(0); + assertThat(filmEdgeType.getInVertexType().getName()).isEqualTo("Film"); + assertThat(filmEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); - assertEquals("HasActor", actorEdgeType.getName()); - assertEquals(0, actorEdgeType.getProperties().size()); - assertEquals("Actor", actorEdgeType.getInVertexType().getName()); - assertEquals(1, actorEdgeType.getNumberRelationshipsRepresented()); + assertThat(actorEdgeType.getName()).isEqualTo("HasActor"); + assertThat(actorEdgeType.getProperties().size()).isEqualTo(0); + assertThat(actorEdgeType.getInVertexType().getName()).isEqualTo("Actor"); + assertThat(actorEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); /* * Rules check @@ -1059,81 +1056,81 @@ public void buildGraphModelFromJoinTableAnd2ParentTables() { // Classes Mapping - assertEquals(3, mapper.getVertexType2EVClassMappers().size()); - assertEquals(3, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(3); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(3); Entity filmEntity = mapper.getDataBaseSchema().getEntityByName("FILM"); - assertEquals(1, mapper.getEVClassMappersByVertex(filmVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(filmVertexType).size()).isEqualTo(1); EVClassMapper filmClassMapper = mapper.getEVClassMappersByVertex(filmVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(filmEntity).size()); - assertEquals(filmClassMapper, mapper.getEVClassMappersByEntity(filmEntity).get(0)); - assertEquals(filmClassMapper.getEntity(), filmEntity); - assertEquals(filmClassMapper.getVertexType(), filmVertexType); - - assertEquals(3, filmClassMapper.getAttribute2property().size()); - assertEquals(3, filmClassMapper.getProperty2attribute().size()); - assertEquals("id", filmClassMapper.getAttribute2property().get("ID")); - assertEquals("title", filmClassMapper.getAttribute2property().get("TITLE")); - assertEquals("year", filmClassMapper.getAttribute2property().get("YEAR")); - assertEquals("ID", filmClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", filmClassMapper.getProperty2attribute().get("title")); - assertEquals("YEAR", filmClassMapper.getProperty2attribute().get("year")); + assertThat(mapper.getEVClassMappersByEntity(filmEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(filmEntity).get(0)).isEqualTo(filmClassMapper); + assertThat(filmEntity).isEqualTo(filmClassMapper.getEntity()); + assertThat(filmVertexType).isEqualTo(filmClassMapper.getVertexType()); + + assertThat(filmClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(filmClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(filmClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(filmClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(filmClassMapper.getAttribute2property().get("YEAR")).isEqualTo("year"); + assertThat(filmClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(filmClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(filmClassMapper.getProperty2attribute().get("year")).isEqualTo("YEAR"); Entity actorEntity = mapper.getDataBaseSchema().getEntityByName("ACTOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(actorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(actorVertexType).size()).isEqualTo(1); EVClassMapper actorClassMapper = mapper.getEVClassMappersByVertex(actorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(actorEntity).size()); - assertEquals(actorClassMapper, mapper.getEVClassMappersByEntity(actorEntity).get(0)); - assertEquals(actorClassMapper.getEntity(), actorEntity); - assertEquals(actorClassMapper.getVertexType(), actorVertexType); - - assertEquals(3, actorClassMapper.getAttribute2property().size()); - assertEquals(3, actorClassMapper.getProperty2attribute().size()); - assertEquals("id", actorClassMapper.getAttribute2property().get("ID")); - assertEquals("name", actorClassMapper.getAttribute2property().get("NAME")); - assertEquals("surname", actorClassMapper.getAttribute2property().get("SURNAME")); - assertEquals("ID", actorClassMapper.getProperty2attribute().get("id")); - assertEquals("NAME", actorClassMapper.getProperty2attribute().get("name")); - assertEquals("SURNAME", actorClassMapper.getProperty2attribute().get("surname")); + assertThat(mapper.getEVClassMappersByEntity(actorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(actorEntity).get(0)).isEqualTo(actorClassMapper); + assertThat(actorEntity).isEqualTo(actorClassMapper.getEntity()); + assertThat(actorVertexType).isEqualTo(actorClassMapper.getVertexType()); + + assertThat(actorClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(actorClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(actorClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(actorClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(actorClassMapper.getAttribute2property().get("SURNAME")).isEqualTo("surname"); + assertThat(actorClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(actorClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); + assertThat(actorClassMapper.getProperty2attribute().get("surname")).isEqualTo("SURNAME"); Entity filmActorEntity = mapper.getDataBaseSchema().getEntityByName("FILM_ACTOR"); - assertEquals(1, mapper.getEVClassMappersByVertex(film2actorVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(film2actorVertexType).size()).isEqualTo(1); EVClassMapper filmActorClassMapper = mapper.getEVClassMappersByVertex(film2actorVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(filmActorEntity).size()); - assertEquals(filmActorClassMapper, mapper.getEVClassMappersByEntity(filmActorEntity).get(0)); - assertEquals(filmActorClassMapper.getEntity(), filmActorEntity); - assertEquals(filmActorClassMapper.getVertexType(), film2actorVertexType); - - assertEquals(2, filmActorClassMapper.getAttribute2property().size()); - assertEquals(2, filmActorClassMapper.getProperty2attribute().size()); - assertEquals("filmId", filmActorClassMapper.getAttribute2property().get("FILM_ID")); - assertEquals("actorId", filmActorClassMapper.getAttribute2property().get("ACTOR_ID")); - assertEquals("FILM_ID", filmActorClassMapper.getProperty2attribute().get("filmId")); - assertEquals("ACTOR_ID", filmActorClassMapper.getProperty2attribute().get("actorId")); + assertThat(mapper.getEVClassMappersByEntity(filmActorEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(filmActorEntity).get(0)).isEqualTo(filmActorClassMapper); + assertThat(filmActorEntity).isEqualTo(filmActorClassMapper.getEntity()); + assertThat(film2actorVertexType).isEqualTo(filmActorClassMapper.getVertexType()); + + assertThat(filmActorClassMapper.getAttribute2property().size()).isEqualTo(2); + assertThat(filmActorClassMapper.getProperty2attribute().size()).isEqualTo(2); + assertThat(filmActorClassMapper.getAttribute2property().get("FILM_ID")).isEqualTo("filmId"); + assertThat(filmActorClassMapper.getAttribute2property().get("ACTOR_ID")).isEqualTo("actorId"); + assertThat(filmActorClassMapper.getProperty2attribute().get("filmId")).isEqualTo("FILM_ID"); + assertThat(filmActorClassMapper.getProperty2attribute().get("actorId")).isEqualTo("ACTOR_ID"); // Relationships-Edges Mapping Iterator it = filmActorEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasActorRelationship = it.next(); CanonicalRelationship hasFilmRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, mapper.getRelationship2edgeType().size()); - assertEquals(filmEdgeType, mapper.getRelationship2edgeType().get(hasFilmRelationship)); - assertEquals(actorEdgeType, mapper.getRelationship2edgeType().get(hasActorRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(2); + assertThat(mapper.getRelationship2edgeType().get(hasFilmRelationship)).isEqualTo(filmEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasActorRelationship)).isEqualTo(actorEdgeType); - assertEquals(2, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(filmEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(filmEdgeType).contains(hasFilmRelationship)); - assertEquals(1, mapper.getEdgeType2relationships().get(actorEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(actorEdgeType).contains(hasActorRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(filmEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(filmEdgeType).contains(hasFilmRelationship)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(actorEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(actorEdgeType).contains(hasActorRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1142,18 +1139,18 @@ public void buildGraphModelFromJoinTableAnd2ParentTables() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two tables: 1 Foreign and 1 Parent (parent has an inner referential integrity). * The primary key is imported both by the foreign table and the attribute of the parent table itself. */ - public void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { + @Test + void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { Connection connection = null; Statement st = null; @@ -1182,10 +1179,10 @@ public void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfModelVertices); - assertEquals(2, statistics.builtModelVertexTypes); - assertEquals(2, statistics.totalNumberOfModelEdges); - assertEquals(2, statistics.builtModelEdgeTypes); + assertThat(statistics.totalNumberOfModelVertices).isEqualTo(2); + assertThat(statistics.builtModelVertexTypes).isEqualTo(2); + assertThat(statistics.totalNumberOfModelEdges).isEqualTo(2); + assertThat(statistics.builtModelEdgeTypes).isEqualTo(2); /* * Testing built graph model @@ -1196,65 +1193,65 @@ public void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { EdgeType mgrEdgeType = mapper.getGraphModel().getEdgeTypeByName("HasMgr"); // vertices check - assertEquals(2, mapper.getGraphModel().getVerticesType().size()); - assertNotNull(employeeVertexType); - assertNotNull(projectVertexType); + assertThat(mapper.getGraphModel().getVerticesType().size()).isEqualTo(2); + assertThat(employeeVertexType).isNotNull(); + assertThat(projectVertexType).isNotNull(); // properties check - assertEquals(3, employeeVertexType.getProperties().size()); - - assertNotNull(employeeVertexType.getPropertyByName("empId")); - assertEquals("empId", employeeVertexType.getPropertyByName("empId").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("empId").getOriginalType()); - assertEquals(1, employeeVertexType.getPropertyByName("empId").getOrdinalPosition()); - assertEquals(true, employeeVertexType.getPropertyByName("empId").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("mgrId")); - assertEquals("mgrId", employeeVertexType.getPropertyByName("mgrId").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("mgrId").getOriginalType()); - assertEquals(2, employeeVertexType.getPropertyByName("mgrId").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("mgrId").isFromPrimaryKey()); - - assertNotNull(employeeVertexType.getPropertyByName("name")); - assertEquals("name", employeeVertexType.getPropertyByName("name").getName()); - assertEquals("VARCHAR", employeeVertexType.getPropertyByName("name").getOriginalType()); - assertEquals(3, employeeVertexType.getPropertyByName("name").getOrdinalPosition()); - assertEquals(false, employeeVertexType.getPropertyByName("name").isFromPrimaryKey()); - - assertEquals(3, projectVertexType.getProperties().size()); - - assertNotNull(projectVertexType.getPropertyByName("id")); - assertEquals("id", projectVertexType.getPropertyByName("id").getName()); - assertEquals("VARCHAR", projectVertexType.getPropertyByName("id").getOriginalType()); - assertEquals(1, projectVertexType.getPropertyByName("id").getOrdinalPosition()); - assertEquals(true, projectVertexType.getPropertyByName("id").isFromPrimaryKey()); - - assertNotNull(projectVertexType.getPropertyByName("title")); - assertEquals("title", projectVertexType.getPropertyByName("title").getName()); - assertEquals("VARCHAR", projectVertexType.getPropertyByName("title").getOriginalType()); - assertEquals(2, projectVertexType.getPropertyByName("title").getOrdinalPosition()); - assertEquals(false, projectVertexType.getPropertyByName("title").isFromPrimaryKey()); - - assertNotNull(projectVertexType.getPropertyByName("projectManager")); - assertEquals("projectManager", projectVertexType.getPropertyByName("projectManager").getName()); - assertEquals("VARCHAR", projectVertexType.getPropertyByName("projectManager").getOriginalType()); - assertEquals(3, projectVertexType.getPropertyByName("projectManager").getOrdinalPosition()); - assertEquals(false, projectVertexType.getPropertyByName("projectManager").isFromPrimaryKey()); + assertThat(employeeVertexType.getProperties().size()).isEqualTo(3); + + assertThat(employeeVertexType.getPropertyByName("empId")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("empId").getName()).isEqualTo("empId"); + assertThat(employeeVertexType.getPropertyByName("empId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("empId").getOrdinalPosition()).isEqualTo(1); + assertThat(employeeVertexType.getPropertyByName("empId").isFromPrimaryKey()).isTrue(); + + assertThat(employeeVertexType.getPropertyByName("mgrId")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("mgrId").getName()).isEqualTo("mgrId"); + assertThat(employeeVertexType.getPropertyByName("mgrId").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("mgrId").getOrdinalPosition()).isEqualTo(2); + assertThat(employeeVertexType.getPropertyByName("mgrId").isFromPrimaryKey()).isFalse(); + + assertThat(employeeVertexType.getPropertyByName("name")).isNotNull(); + assertThat(employeeVertexType.getPropertyByName("name").getName()).isEqualTo("name"); + assertThat(employeeVertexType.getPropertyByName("name").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(employeeVertexType.getPropertyByName("name").getOrdinalPosition()).isEqualTo(3); + assertThat(employeeVertexType.getPropertyByName("name").isFromPrimaryKey()).isFalse(); + + assertThat(projectVertexType.getProperties().size()).isEqualTo(3); + + assertThat(projectVertexType.getPropertyByName("id")).isNotNull(); + assertThat(projectVertexType.getPropertyByName("id").getName()).isEqualTo("id"); + assertThat(projectVertexType.getPropertyByName("id").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectVertexType.getPropertyByName("id").getOrdinalPosition()).isEqualTo(1); + assertThat(projectVertexType.getPropertyByName("id").isFromPrimaryKey()).isTrue(); + + assertThat(projectVertexType.getPropertyByName("title")).isNotNull(); + assertThat(projectVertexType.getPropertyByName("title").getName()).isEqualTo("title"); + assertThat(projectVertexType.getPropertyByName("title").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectVertexType.getPropertyByName("title").getOrdinalPosition()).isEqualTo(2); + assertThat(projectVertexType.getPropertyByName("title").isFromPrimaryKey()).isFalse(); + + assertThat(projectVertexType.getPropertyByName("projectManager")).isNotNull(); + assertThat(projectVertexType.getPropertyByName("projectManager").getName()).isEqualTo("projectManager"); + assertThat(projectVertexType.getPropertyByName("projectManager").getOriginalType()).isEqualTo("VARCHAR"); + assertThat(projectVertexType.getPropertyByName("projectManager").getOrdinalPosition()).isEqualTo(3); + assertThat(projectVertexType.getPropertyByName("projectManager").isFromPrimaryKey()).isFalse(); // edges check - assertEquals(2, mapper.getGraphModel().getEdgesType().size()); - assertNotNull(mgrEdgeType); - assertNotNull(projectManagerEdgeType); + assertThat(mapper.getGraphModel().getEdgesType().size()).isEqualTo(2); + assertThat(mgrEdgeType).isNotNull(); + assertThat(projectManagerEdgeType).isNotNull(); - assertEquals("HasMgr", mgrEdgeType.getName()); - assertEquals(0, mgrEdgeType.getProperties().size()); - assertEquals("Employee", mgrEdgeType.getInVertexType().getName()); - assertEquals(1, mgrEdgeType.getNumberRelationshipsRepresented()); + assertThat(mgrEdgeType.getName()).isEqualTo("HasMgr"); + assertThat(mgrEdgeType.getProperties().size()).isEqualTo(0); + assertThat(mgrEdgeType.getInVertexType().getName()).isEqualTo("Employee"); + assertThat(mgrEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); - assertEquals("HasProjectManager", projectManagerEdgeType.getName()); - assertEquals(0, projectManagerEdgeType.getProperties().size()); - assertEquals("Employee", projectManagerEdgeType.getInVertexType().getName()); - assertEquals(1, projectManagerEdgeType.getNumberRelationshipsRepresented()); + assertThat(projectManagerEdgeType.getName()).isEqualTo("HasProjectManager"); + assertThat(projectManagerEdgeType.getProperties().size()).isEqualTo(0); + assertThat(projectManagerEdgeType.getInVertexType().getName()).isEqualTo("Employee"); + assertThat(projectManagerEdgeType.getNumberRelationshipsRepresented()).isEqualTo(1); /* * Rules check @@ -1262,68 +1259,68 @@ public void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { // Classes Mapping - assertEquals(2, mapper.getVertexType2EVClassMappers().size()); - assertEquals(2, mapper.getEntity2EVClassMappers().size()); + assertThat(mapper.getVertexType2EVClassMappers().size()).isEqualTo(2); + assertThat(mapper.getEntity2EVClassMappers().size()).isEqualTo(2); Entity employeeEntity = mapper.getDataBaseSchema().getEntityByName("EMPLOYEE"); - assertEquals(1, mapper.getEVClassMappersByVertex(employeeVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(employeeVertexType).size()).isEqualTo(1); EVClassMapper employeeClassMapper = mapper.getEVClassMappersByVertex(employeeVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(employeeEntity).size()); - assertEquals(employeeClassMapper, mapper.getEVClassMappersByEntity(employeeEntity).get(0)); - assertEquals(employeeClassMapper.getEntity(), employeeEntity); - assertEquals(employeeClassMapper.getVertexType(), employeeVertexType); - - assertEquals(3, employeeClassMapper.getAttribute2property().size()); - assertEquals(3, employeeClassMapper.getProperty2attribute().size()); - assertEquals("empId", employeeClassMapper.getAttribute2property().get("EMP_ID")); - assertEquals("mgrId", employeeClassMapper.getAttribute2property().get("MGR_ID")); - assertEquals("name", employeeClassMapper.getAttribute2property().get("NAME")); - assertEquals("EMP_ID", employeeClassMapper.getProperty2attribute().get("empId")); - assertEquals("MGR_ID", employeeClassMapper.getProperty2attribute().get("mgrId")); - assertEquals("NAME", employeeClassMapper.getProperty2attribute().get("name")); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(employeeEntity).get(0)).isEqualTo(employeeClassMapper); + assertThat(employeeEntity).isEqualTo(employeeClassMapper.getEntity()); + assertThat(employeeVertexType).isEqualTo(employeeClassMapper.getVertexType()); + + assertThat(employeeClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(employeeClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(employeeClassMapper.getAttribute2property().get("EMP_ID")).isEqualTo("empId"); + assertThat(employeeClassMapper.getAttribute2property().get("MGR_ID")).isEqualTo("mgrId"); + assertThat(employeeClassMapper.getAttribute2property().get("NAME")).isEqualTo("name"); + assertThat(employeeClassMapper.getProperty2attribute().get("empId")).isEqualTo("EMP_ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("mgrId")).isEqualTo("MGR_ID"); + assertThat(employeeClassMapper.getProperty2attribute().get("name")).isEqualTo("NAME"); Entity projectEntity = mapper.getDataBaseSchema().getEntityByName("PROJECT"); - assertEquals(1, mapper.getEVClassMappersByVertex(projectVertexType).size()); + assertThat(mapper.getEVClassMappersByVertex(projectVertexType).size()).isEqualTo(1); EVClassMapper projectClassMapper = mapper.getEVClassMappersByVertex(projectVertexType).get(0); - assertEquals(1, mapper.getEVClassMappersByEntity(projectEntity).size()); - assertEquals(projectClassMapper, mapper.getEVClassMappersByEntity(projectEntity).get(0)); - assertEquals(projectClassMapper.getEntity(), projectEntity); - assertEquals(projectClassMapper.getVertexType(), projectVertexType); - - assertEquals(3, projectClassMapper.getAttribute2property().size()); - assertEquals(3, projectClassMapper.getProperty2attribute().size()); - assertEquals("id", projectClassMapper.getAttribute2property().get("ID")); - assertEquals("title", projectClassMapper.getAttribute2property().get("TITLE")); - assertEquals("projectManager", projectClassMapper.getAttribute2property().get("PROJECT_MANAGER")); - assertEquals("ID", projectClassMapper.getProperty2attribute().get("id")); - assertEquals("TITLE", projectClassMapper.getProperty2attribute().get("title")); - assertEquals("PROJECT_MANAGER", projectClassMapper.getProperty2attribute().get("projectManager")); + assertThat(mapper.getEVClassMappersByEntity(projectEntity).size()).isEqualTo(1); + assertThat(mapper.getEVClassMappersByEntity(projectEntity).get(0)).isEqualTo(projectClassMapper); + assertThat(projectEntity).isEqualTo(projectClassMapper.getEntity()); + assertThat(projectVertexType).isEqualTo(projectClassMapper.getVertexType()); + + assertThat(projectClassMapper.getAttribute2property().size()).isEqualTo(3); + assertThat(projectClassMapper.getProperty2attribute().size()).isEqualTo(3); + assertThat(projectClassMapper.getAttribute2property().get("ID")).isEqualTo("id"); + assertThat(projectClassMapper.getAttribute2property().get("TITLE")).isEqualTo("title"); + assertThat(projectClassMapper.getAttribute2property().get("PROJECT_MANAGER")).isEqualTo("projectManager"); + assertThat(projectClassMapper.getProperty2attribute().get("id")).isEqualTo("ID"); + assertThat(projectClassMapper.getProperty2attribute().get("title")).isEqualTo("TITLE"); + assertThat(projectClassMapper.getProperty2attribute().get("projectManager")).isEqualTo("PROJECT_MANAGER"); // Relationships-Edges Mapping Iterator it = employeeEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasManagerRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); it = projectEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship hasProjectManagerRelationship = it.next(); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); - assertEquals(2, mapper.getRelationship2edgeType().size()); - assertEquals(mgrEdgeType, mapper.getRelationship2edgeType().get(hasManagerRelationship)); - assertEquals(projectManagerEdgeType, mapper.getRelationship2edgeType().get(hasProjectManagerRelationship)); + assertThat(mapper.getRelationship2edgeType().size()).isEqualTo(2); + assertThat(mapper.getRelationship2edgeType().get(hasManagerRelationship)).isEqualTo(mgrEdgeType); + assertThat(mapper.getRelationship2edgeType().get(hasProjectManagerRelationship)).isEqualTo(projectManagerEdgeType); - assertEquals(2, mapper.getEdgeType2relationships().size()); - assertEquals(1, mapper.getEdgeType2relationships().get(mgrEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(mgrEdgeType).contains(hasManagerRelationship)); - assertEquals(1, mapper.getEdgeType2relationships().get(projectManagerEdgeType).size()); - assertTrue(mapper.getEdgeType2relationships().get(projectManagerEdgeType).contains(hasProjectManagerRelationship)); + assertThat(mapper.getEdgeType2relationships().size()).isEqualTo(2); + assertThat(mapper.getEdgeType2relationships().get(mgrEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(mgrEdgeType).contains(hasManagerRelationship)).isTrue(); + assertThat(mapper.getEdgeType2relationships().get(projectManagerEdgeType).size()).isEqualTo(1); + assertThat(mapper.getEdgeType2relationships().get(projectManagerEdgeType).contains(hasProjectManagerRelationship)).isTrue(); // JoinVertexes-AggregatorEdges Mapping - assertEquals(0, mapper.getJoinVertex2aggregatorEdges().size()); + assertThat(mapper.getJoinVertex2aggregatorEdges().size()).isEqualTo(0); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -1332,7 +1329,7 @@ public void buildGraphModelFromTwoTablesWithOneSimplePKImportedTwice() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/SourceSchemaBuildingTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/SourceSchemaBuildingTest.java index 152f2e3e..b3e98a70 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/SourceSchemaBuildingTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/mapper/SourceSchemaBuildingTest.java @@ -40,10 +40,8 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import com.arcadeanalytics.provider.DataSourceInfo; import com.arcadeanalytics.provider.rdbms.context.Statistics; @@ -66,7 +64,7 @@ * @author Gabriele Ponzi */ -public class SourceSchemaBuildingTest { +class SourceSchemaBuildingTest { private ER2GraphMapper mapper; private DBQueryEngine dbQueryEngine; @@ -81,7 +79,7 @@ public class SourceSchemaBuildingTest { private Statistics statistics; @BeforeEach - public void init() { + void init() { this.dataSource = new DataSourceInfo( 1L, @@ -112,12 +110,12 @@ public void init() { this.mapper = new ER2GraphMapper(dataSource, null, null, dbQueryEngine, dataTypeHandler, executionStrategy, nameResolver, statistics); } - @Test /* * Two Foreign tables and one Parent with a simple primary key imported from the parent table. */ - public void buildSourceSchemaFromTwoTablesWithOneSimplePK() { + @Test + void buildSourceSchemaFromTwoTablesWithOneSimplePK() { Connection connection = null; Statement st = null; @@ -141,10 +139,10 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePK() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); /* * Testing built source db schema @@ -154,72 +152,72 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePK() { Entity foreignEntity = mapper.getDataBaseSchema().getEntityByName("FOREIGN_BOOK"); // entities check - assertEquals(2, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(parentEntity); - assertNotNull(foreignEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(2); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity).isNotNull(); + assertThat(foreignEntity).isNotNull(); // attributes check - assertEquals(2, parentEntity.getAttributes().size()); - - assertNotNull(parentEntity.getAttributeByName("AUTHOR_ID")); - assertEquals("AUTHOR_ID", parentEntity.getAttributeByName("AUTHOR_ID").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("AUTHOR_ID").getDataType()); - assertEquals(1, parentEntity.getAttributeByName("AUTHOR_ID").getOrdinalPosition()); - assertEquals("PARENT_AUTHOR", parentEntity.getAttributeByName("AUTHOR_ID").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("AUTHOR_NAME")); - assertEquals("AUTHOR_NAME", parentEntity.getAttributeByName("AUTHOR_NAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("AUTHOR_NAME").getDataType()); - assertEquals(2, parentEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()); - assertEquals("PARENT_AUTHOR", parentEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()); - - assertEquals(3, foreignEntity.getAttributes().size()); - - assertNotNull(foreignEntity.getAttributeByName("BOOK_ID")); - assertEquals("BOOK_ID", foreignEntity.getAttributeByName("BOOK_ID").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("BOOK_ID").getDataType()); - assertEquals(1, foreignEntity.getAttributeByName("BOOK_ID").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("BOOK_ID").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("TITLE")); - assertEquals("TITLE", foreignEntity.getAttributeByName("TITLE").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TITLE").getDataType()); - assertEquals(2, foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR")); - assertEquals("AUTHOR", foreignEntity.getAttributeByName("AUTHOR").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR").getDataType()); - assertEquals(3, foreignEntity.getAttributeByName("AUTHOR").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("AUTHOR").getBelongingEntity().getName()); + assertThat(parentEntity.getAttributes().size()).isEqualTo(2); + + assertThat(parentEntity.getAttributeByName("AUTHOR_ID")).isNotNull(); + assertThat(parentEntity.getAttributeByName("AUTHOR_ID").getName()).isEqualTo("AUTHOR_ID"); + assertThat(parentEntity.getAttributeByName("AUTHOR_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("AUTHOR_ID").getOrdinalPosition()).isEqualTo(1); + assertThat(parentEntity.getAttributeByName("AUTHOR_ID").getBelongingEntity().getName()).isEqualTo("PARENT_AUTHOR"); + + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getName()).isEqualTo("AUTHOR_NAME"); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()).isEqualTo("PARENT_AUTHOR"); + + assertThat(foreignEntity.getAttributes().size()).isEqualTo(3); + + assertThat(foreignEntity.getAttributeByName("BOOK_ID")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("BOOK_ID").getName()).isEqualTo("BOOK_ID"); + assertThat(foreignEntity.getAttributeByName("BOOK_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("BOOK_ID").getOrdinalPosition()).isEqualTo(1); + assertThat(foreignEntity.getAttributeByName("BOOK_ID").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); + + assertThat(foreignEntity.getAttributeByName("TITLE")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TITLE").getName()).isEqualTo("TITLE"); + assertThat(foreignEntity.getAttributeByName("TITLE").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()).isEqualTo(2); + assertThat(foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getName()).isEqualTo("AUTHOR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getOrdinalPosition()).isEqualTo(3); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); // relationship, primary and foreign key check - assertEquals(1, foreignEntity.getOutCanonicalRelationships().size()); - assertEquals(0, parentEntity.getOutCanonicalRelationships().size()); - assertEquals(0, foreignEntity.getInCanonicalRelationships().size()); - assertEquals(1, parentEntity.getInCanonicalRelationships().size()); - assertEquals(0, parentEntity.getForeignKeys().size()); - assertEquals(1, foreignEntity.getForeignKeys().size()); + assertThat(foreignEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(foreignEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(parentEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(foreignEntity.getForeignKeys().size()).isEqualTo(1); Iterator it = foreignEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("PARENT_AUTHOR", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_BOOK", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_AUTHOR"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_BOOK"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(0)); Iterator it2 = parentEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("AUTHOR", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("AUTHOR_ID", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR_ID"); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -228,17 +226,17 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePK() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two Foreign tables and one Parent with a composite primary key imported from the parent table. */ - public void buildSourceSchemaFromThreeTablesWithOneCompositePK() { + @Test + void buildSourceSchemaFromThreeTablesWithOneCompositePK() { Connection connection = null; Statement st = null; @@ -264,10 +262,10 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePK() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(1, statistics.totalNumberOfRelationships); - assertEquals(1, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(1); + assertThat(statistics.builtRelationships).isEqualTo(1); /* * Testing built source db schema @@ -277,80 +275,80 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePK() { Entity foreignEntity = mapper.getDataBaseSchema().getEntityByName("FOREIGN_BOOK"); // entities check - assertEquals(2, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(1, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(parentEntity); - assertNotNull(foreignEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(2); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity).isNotNull(); + assertThat(foreignEntity).isNotNull(); // attributes check - assertEquals(3, parentEntity.getAttributes().size()); - - assertNotNull(parentEntity.getAttributeByName("AUTHOR_NAME")); - assertEquals("AUTHOR_NAME", parentEntity.getAttributeByName("AUTHOR_NAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("AUTHOR_NAME").getDataType()); - assertEquals(1, parentEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()); - assertEquals("PARENT_AUTHOR", parentEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("AUTHOR_SURNAME")); - assertEquals("AUTHOR_SURNAME", parentEntity.getAttributeByName("AUTHOR_SURNAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()); - assertEquals(2, parentEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()); - assertEquals("PARENT_AUTHOR", parentEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("AGE")); - assertEquals("AGE", parentEntity.getAttributeByName("AGE").getName()); - assertEquals("INTEGER", parentEntity.getAttributeByName("AGE").getDataType()); - assertEquals(3, parentEntity.getAttributeByName("AGE").getOrdinalPosition()); - assertEquals("PARENT_AUTHOR", parentEntity.getAttributeByName("AGE").getBelongingEntity().getName()); - - assertEquals(3, foreignEntity.getAttributes().size()); - - assertNotNull(foreignEntity.getAttributeByName("TITLE")); - assertEquals("TITLE", foreignEntity.getAttributeByName("TITLE").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TITLE").getDataType()); - assertEquals(1, foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR_NAME")); - assertEquals("AUTHOR_NAME", foreignEntity.getAttributeByName("AUTHOR_NAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR_NAME").getDataType()); - assertEquals(2, foreignEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR_SURNAME")); - assertEquals("AUTHOR_SURNAME", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()); - assertEquals(3, foreignEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()); - assertEquals("FOREIGN_BOOK", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()); + assertThat(parentEntity.getAttributes().size()).isEqualTo(3); + + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getName()).isEqualTo("AUTHOR_NAME"); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()).isEqualTo(1); + assertThat(parentEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()).isEqualTo("PARENT_AUTHOR"); + + assertThat(parentEntity.getAttributeByName("AUTHOR_SURNAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("AUTHOR_SURNAME").getName()).isEqualTo("AUTHOR_SURNAME"); + assertThat(parentEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()).isEqualTo(2); + assertThat(parentEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()).isEqualTo("PARENT_AUTHOR"); + + assertThat(parentEntity.getAttributeByName("AGE")).isNotNull(); + assertThat(parentEntity.getAttributeByName("AGE").getName()).isEqualTo("AGE"); + assertThat(parentEntity.getAttributeByName("AGE").getDataType()).isEqualTo("INTEGER"); + assertThat(parentEntity.getAttributeByName("AGE").getOrdinalPosition()).isEqualTo(3); + assertThat(parentEntity.getAttributeByName("AGE").getBelongingEntity().getName()).isEqualTo("PARENT_AUTHOR"); + + assertThat(foreignEntity.getAttributes().size()).isEqualTo(3); + + assertThat(foreignEntity.getAttributeByName("TITLE")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TITLE").getName()).isEqualTo("TITLE"); + assertThat(foreignEntity.getAttributeByName("TITLE").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()).isEqualTo(1); + assertThat(foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getName()).isEqualTo("AUTHOR_NAME"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getName()).isEqualTo("AUTHOR_SURNAME"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()).isEqualTo(3); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_BOOK"); // relationship, primary and foreign key check - assertEquals(1, foreignEntity.getOutCanonicalRelationships().size()); - assertEquals(0, parentEntity.getOutCanonicalRelationships().size()); - assertEquals(0, foreignEntity.getInCanonicalRelationships().size()); - assertEquals(1, parentEntity.getInCanonicalRelationships().size()); - assertEquals(0, parentEntity.getForeignKeys().size()); - assertEquals(1, foreignEntity.getForeignKeys().size()); + assertThat(foreignEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(foreignEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(parentEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(foreignEntity.getForeignKeys().size()).isEqualTo(1); Iterator it = foreignEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("PARENT_AUTHOR", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_BOOK", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_AUTHOR"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_BOOK"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(0)); Iterator it2 = parentEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("AUTHOR_NAME", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("AUTHOR_SURNAME", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(1).getName()); - assertEquals("AUTHOR_NAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("AUTHOR_SURNAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR_NAME"); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(1).getName()).isEqualTo("AUTHOR_SURNAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR_NAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()).isEqualTo("AUTHOR_SURNAME"); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -359,17 +357,17 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePK() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two Foreign tables and one Parent with a simple primary key imported twice from the parent table. */ - public void buildSourceSchemaFromThreeTablesWithOneSimplePKImportedTwice() { + @Test + void buildSourceSchemaFromThreeTablesWithOneSimplePKImportedTwice() { Connection connection = null; Statement st = null; @@ -395,10 +393,10 @@ public void buildSourceSchemaFromThreeTablesWithOneSimplePKImportedTwice() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(2, statistics.totalNumberOfRelationships); - assertEquals(2, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(2); + assertThat(statistics.builtRelationships).isEqualTo(2); /* * Testing built source db schema @@ -408,86 +406,86 @@ public void buildSourceSchemaFromThreeTablesWithOneSimplePKImportedTwice() { Entity foreignEntity = mapper.getDataBaseSchema().getEntityByName("FOREIGN_ARTICLE"); // entities check - assertEquals(2, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(2, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(parentEntity); - assertNotNull(foreignEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(2); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity).isNotNull(); + assertThat(foreignEntity).isNotNull(); // attributes check - assertEquals(2, parentEntity.getAttributes().size()); - - assertNotNull(parentEntity.getAttributeByName("PERSON_ID")); - assertEquals("PERSON_ID", parentEntity.getAttributeByName("PERSON_ID").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("PERSON_ID").getDataType()); - assertEquals(1, parentEntity.getAttributeByName("PERSON_ID").getOrdinalPosition()); - assertEquals("PARENT_PERSON", parentEntity.getAttributeByName("PERSON_ID").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("NAME")); - assertEquals("NAME", parentEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("NAME").getDataType()); - assertEquals(2, parentEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("PARENT_PERSON", parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(3, foreignEntity.getAttributes().size()); - - assertNotNull(foreignEntity.getAttributeByName("TITLE")); - assertEquals("TITLE", foreignEntity.getAttributeByName("TITLE").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TITLE").getDataType()); - assertEquals(1, foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR")); - assertEquals("AUTHOR", foreignEntity.getAttributeByName("AUTHOR").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR").getDataType()); - assertEquals(2, foreignEntity.getAttributeByName("AUTHOR").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("AUTHOR").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("TRANSLATOR")); - assertEquals("TRANSLATOR", foreignEntity.getAttributeByName("TRANSLATOR").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TRANSLATOR").getDataType()); - assertEquals(3, foreignEntity.getAttributeByName("TRANSLATOR").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("TRANSLATOR").getBelongingEntity().getName()); + assertThat(parentEntity.getAttributes().size()).isEqualTo(2); + + assertThat(parentEntity.getAttributeByName("PERSON_ID")).isNotNull(); + assertThat(parentEntity.getAttributeByName("PERSON_ID").getName()).isEqualTo("PERSON_ID"); + assertThat(parentEntity.getAttributeByName("PERSON_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("PERSON_ID").getOrdinalPosition()).isEqualTo(1); + assertThat(parentEntity.getAttributeByName("PERSON_ID").getBelongingEntity().getName()).isEqualTo("PARENT_PERSON"); + + assertThat(parentEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(parentEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("PARENT_PERSON"); + + assertThat(foreignEntity.getAttributes().size()).isEqualTo(3); + + assertThat(foreignEntity.getAttributeByName("TITLE")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TITLE").getName()).isEqualTo("TITLE"); + assertThat(foreignEntity.getAttributeByName("TITLE").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()).isEqualTo(1); + assertThat(foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getName()).isEqualTo("AUTHOR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getOrdinalPosition()).isEqualTo(2); + assertThat(foreignEntity.getAttributeByName("AUTHOR").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("TRANSLATOR")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR").getName()).isEqualTo("TRANSLATOR"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR").getOrdinalPosition()).isEqualTo(3); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); // relationship, primary and foreign key check - assertEquals(2, foreignEntity.getOutCanonicalRelationships().size()); - assertEquals(0, parentEntity.getOutCanonicalRelationships().size()); - assertEquals(0, foreignEntity.getInCanonicalRelationships().size()); - assertEquals(2, parentEntity.getInCanonicalRelationships().size()); - assertEquals(0, parentEntity.getForeignKeys().size()); - assertEquals(2, foreignEntity.getForeignKeys().size()); + assertThat(foreignEntity.getOutCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(foreignEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(parentEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(foreignEntity.getForeignKeys().size()).isEqualTo(2); // first relationship Iterator it = foreignEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("PARENT_PERSON", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_ARTICLE", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_PERSON"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(0)); Iterator it2 = parentEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("AUTHOR", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("PERSON_ID", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("PERSON_ID"); // second relationship currentRelationship = it.next(); - assertEquals("PARENT_PERSON", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_ARTICLE", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(1), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_PERSON"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(1)); currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("TRANSLATOR", foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()); - assertEquals("PERSON_ID", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()).isEqualTo("TRANSLATOR"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("PERSON_ID"); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -496,17 +494,17 @@ public void buildSourceSchemaFromThreeTablesWithOneSimplePKImportedTwice() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two Foreign tables and one Parent with a composite primary key imported twice from the parent table. */ - public void buildSourceSchemaFromThreeTablesWithOneCompositePKImportedTwice() { + @Test + void buildSourceSchemaFromThreeTablesWithOneCompositePKImportedTwice() { Connection connection = null; Statement st = null; @@ -533,10 +531,10 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePKImportedTwice() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(2, statistics.totalNumberOfRelationships); - assertEquals(2, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(2); + assertThat(statistics.builtRelationships).isEqualTo(2); /* * Testing built source db schema @@ -546,101 +544,101 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePKImportedTwice() { Entity foreignEntity = mapper.getDataBaseSchema().getEntityByName("FOREIGN_ARTICLE"); // entities check - assertEquals(2, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(2, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(parentEntity); - assertNotNull(foreignEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(2); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity).isNotNull(); + assertThat(foreignEntity).isNotNull(); // attributes check - assertEquals(2, parentEntity.getAttributes().size()); - - assertNotNull(parentEntity.getAttributeByName("NAME")); - assertEquals("NAME", parentEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("NAME").getDataType()); - assertEquals(1, parentEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("PARENT_PERSON", parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("SURNAME")); - assertEquals("SURNAME", parentEntity.getAttributeByName("SURNAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("SURNAME").getDataType()); - assertEquals(2, parentEntity.getAttributeByName("SURNAME").getOrdinalPosition()); - assertEquals("PARENT_PERSON", parentEntity.getAttributeByName("SURNAME").getBelongingEntity().getName()); - - assertEquals(5, foreignEntity.getAttributes().size()); - - assertNotNull(foreignEntity.getAttributeByName("TITLE")); - assertEquals("TITLE", foreignEntity.getAttributeByName("TITLE").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TITLE").getDataType()); - assertEquals(1, foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR_NAME")); - assertEquals("AUTHOR_NAME", foreignEntity.getAttributeByName("AUTHOR_NAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR_NAME").getDataType()); - assertEquals(2, foreignEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("AUTHOR_SURNAME")); - assertEquals("AUTHOR_SURNAME", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()); - assertEquals(3, foreignEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("TRANSLATOR_NAME")); - assertEquals("TRANSLATOR_NAME", foreignEntity.getAttributeByName("TRANSLATOR_NAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TRANSLATOR_NAME").getDataType()); - assertEquals(4, foreignEntity.getAttributeByName("TRANSLATOR_NAME").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("TRANSLATOR_NAME").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME")); - assertEquals("TRANSLATOR_SURNAME", foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getDataType()); - assertEquals(5, foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getOrdinalPosition()); - assertEquals("FOREIGN_ARTICLE", foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getBelongingEntity().getName()); + assertThat(parentEntity.getAttributes().size()).isEqualTo(2); + + assertThat(parentEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(parentEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(1); + assertThat(parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("PARENT_PERSON"); + + assertThat(parentEntity.getAttributeByName("SURNAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("SURNAME").getName()).isEqualTo("SURNAME"); + assertThat(parentEntity.getAttributeByName("SURNAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("SURNAME").getOrdinalPosition()).isEqualTo(2); + assertThat(parentEntity.getAttributeByName("SURNAME").getBelongingEntity().getName()).isEqualTo("PARENT_PERSON"); + + assertThat(foreignEntity.getAttributes().size()).isEqualTo(5); + + assertThat(foreignEntity.getAttributeByName("TITLE")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TITLE").getName()).isEqualTo("TITLE"); + assertThat(foreignEntity.getAttributeByName("TITLE").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()).isEqualTo(1); + assertThat(foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getName()).isEqualTo("AUTHOR_NAME"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getOrdinalPosition()).isEqualTo(2); + assertThat(foreignEntity.getAttributeByName("AUTHOR_NAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getName()).isEqualTo("AUTHOR_SURNAME"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getOrdinalPosition()).isEqualTo(3); + assertThat(foreignEntity.getAttributeByName("AUTHOR_SURNAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_NAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_NAME").getName()).isEqualTo("TRANSLATOR_NAME"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_NAME").getOrdinalPosition()).isEqualTo(4); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_NAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getName()).isEqualTo("TRANSLATOR_SURNAME"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getOrdinalPosition()).isEqualTo(5); + assertThat(foreignEntity.getAttributeByName("TRANSLATOR_SURNAME").getBelongingEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); // relationship, primary and foreign key check - assertEquals(2, foreignEntity.getOutCanonicalRelationships().size()); - assertEquals(0, parentEntity.getOutCanonicalRelationships().size()); - assertEquals(0, foreignEntity.getInCanonicalRelationships().size()); - assertEquals(2, parentEntity.getInCanonicalRelationships().size()); - assertEquals(0, parentEntity.getForeignKeys().size()); - assertEquals(2, foreignEntity.getForeignKeys().size()); + assertThat(foreignEntity.getOutCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(foreignEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(parentEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(foreignEntity.getForeignKeys().size()).isEqualTo(2); // first relationship Iterator it = foreignEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("PARENT_PERSON", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_ARTICLE", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_PERSON"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(0)); Iterator it2 = parentEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("AUTHOR_NAME", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("AUTHOR_SURNAME", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(1).getName()); - assertEquals("NAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("SURNAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("AUTHOR_NAME"); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(1).getName()).isEqualTo("AUTHOR_SURNAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("NAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()).isEqualTo("SURNAME"); // second relationship currentRelationship = it.next(); - assertEquals("PARENT_PERSON", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_ARTICLE", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(1), currentRelationship.getForeignKey()); - assertFalse(it.hasNext()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_PERSON"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_ARTICLE"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(1)); + assertThat(it.hasNext()).isFalse(); currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("TRANSLATOR_NAME", foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()); - assertEquals("TRANSLATOR_SURNAME", foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(1).getName()); - assertEquals("NAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); - assertEquals("SURNAME", parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()); + assertThat(foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()).isEqualTo("TRANSLATOR_NAME"); + assertThat(foreignEntity.getForeignKeys().get(1).getInvolvedAttributes().get(1).getName()).isEqualTo("TRANSLATOR_SURNAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("NAME"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(1).getName()).isEqualTo("SURNAME"); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -649,18 +647,18 @@ public void buildSourceSchemaFromThreeTablesWithOneCompositePKImportedTwice() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Two tables: 1 Foreign and 1 Parent (parent has an inner referential integrity). * The primary key is imported both by the foreign table and from the first attribute of the parent table itself. */ - public void buildSourceSchemaFromTwoTablesWithOneSimplePKImportedTwice() { + @Test + void buildSourceSchemaFromTwoTablesWithOneSimplePKImportedTwice() { Connection connection = null; Statement st = null; @@ -687,10 +685,10 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePKImportedTwice() { * Testing context information */ - assertEquals(2, statistics.totalNumberOfEntities); - assertEquals(2, statistics.builtEntities); - assertEquals(2, statistics.totalNumberOfRelationships); - assertEquals(2, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(2); + assertThat(statistics.builtEntities).isEqualTo(2); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(2); + assertThat(statistics.builtRelationships).isEqualTo(2); /* * Testing built source db schema @@ -700,93 +698,93 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePKImportedTwice() { Entity foreignEntity = mapper.getDataBaseSchema().getEntityByName("FOREIGN_PROJECT"); // entities check - assertEquals(2, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(2, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(parentEntity); - assertNotNull(foreignEntity); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(2); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity).isNotNull(); + assertThat(foreignEntity).isNotNull(); // attributes check - assertEquals(3, parentEntity.getAttributes().size()); - - assertNotNull(parentEntity.getAttributeByName("EMP_ID")); - assertEquals("EMP_ID", parentEntity.getAttributeByName("EMP_ID").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("EMP_ID").getDataType()); - assertEquals(1, parentEntity.getAttributeByName("EMP_ID").getOrdinalPosition()); - assertEquals("PARENT_EMPLOYEE", parentEntity.getAttributeByName("EMP_ID").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("MGR_ID")); - assertEquals("MGR_ID", parentEntity.getAttributeByName("MGR_ID").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("MGR_ID").getDataType()); - assertEquals(2, parentEntity.getAttributeByName("MGR_ID").getOrdinalPosition()); - assertEquals("PARENT_EMPLOYEE", parentEntity.getAttributeByName("MGR_ID").getBelongingEntity().getName()); - - assertNotNull(parentEntity.getAttributeByName("NAME")); - assertEquals("NAME", parentEntity.getAttributeByName("NAME").getName()); - assertEquals("VARCHAR", parentEntity.getAttributeByName("NAME").getDataType()); - assertEquals(3, parentEntity.getAttributeByName("NAME").getOrdinalPosition()); - assertEquals("PARENT_EMPLOYEE", parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()); - - assertEquals(3, foreignEntity.getAttributes().size()); - - assertNotNull(foreignEntity.getAttributeByName("PROJECT_ID")); - assertEquals("PROJECT_ID", foreignEntity.getAttributeByName("PROJECT_ID").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("PROJECT_ID").getDataType()); - assertEquals(1, foreignEntity.getAttributeByName("PROJECT_ID").getOrdinalPosition()); - assertEquals("FOREIGN_PROJECT", foreignEntity.getAttributeByName("PROJECT_ID").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("TITLE")); - assertEquals("TITLE", foreignEntity.getAttributeByName("TITLE").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("TITLE").getDataType()); - assertEquals(2, foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()); - assertEquals("FOREIGN_PROJECT", foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()); - - assertNotNull(foreignEntity.getAttributeByName("PROJECT_MANAGER")); - assertEquals("PROJECT_MANAGER", foreignEntity.getAttributeByName("PROJECT_MANAGER").getName()); - assertEquals("VARCHAR", foreignEntity.getAttributeByName("PROJECT_MANAGER").getDataType()); - assertEquals(3, foreignEntity.getAttributeByName("PROJECT_MANAGER").getOrdinalPosition()); - assertEquals("FOREIGN_PROJECT", foreignEntity.getAttributeByName("PROJECT_MANAGER").getBelongingEntity().getName()); + assertThat(parentEntity.getAttributes().size()).isEqualTo(3); + + assertThat(parentEntity.getAttributeByName("EMP_ID")).isNotNull(); + assertThat(parentEntity.getAttributeByName("EMP_ID").getName()).isEqualTo("EMP_ID"); + assertThat(parentEntity.getAttributeByName("EMP_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("EMP_ID").getOrdinalPosition()).isEqualTo(1); + assertThat(parentEntity.getAttributeByName("EMP_ID").getBelongingEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + + assertThat(parentEntity.getAttributeByName("MGR_ID")).isNotNull(); + assertThat(parentEntity.getAttributeByName("MGR_ID").getName()).isEqualTo("MGR_ID"); + assertThat(parentEntity.getAttributeByName("MGR_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("MGR_ID").getOrdinalPosition()).isEqualTo(2); + assertThat(parentEntity.getAttributeByName("MGR_ID").getBelongingEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + + assertThat(parentEntity.getAttributeByName("NAME")).isNotNull(); + assertThat(parentEntity.getAttributeByName("NAME").getName()).isEqualTo("NAME"); + assertThat(parentEntity.getAttributeByName("NAME").getDataType()).isEqualTo("VARCHAR"); + assertThat(parentEntity.getAttributeByName("NAME").getOrdinalPosition()).isEqualTo(3); + assertThat(parentEntity.getAttributeByName("NAME").getBelongingEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + + assertThat(foreignEntity.getAttributes().size()).isEqualTo(3); + + assertThat(foreignEntity.getAttributeByName("PROJECT_ID")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("PROJECT_ID").getName()).isEqualTo("PROJECT_ID"); + assertThat(foreignEntity.getAttributeByName("PROJECT_ID").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("PROJECT_ID").getOrdinalPosition()).isEqualTo(1); + assertThat(foreignEntity.getAttributeByName("PROJECT_ID").getBelongingEntity().getName()).isEqualTo("FOREIGN_PROJECT"); + + assertThat(foreignEntity.getAttributeByName("TITLE")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("TITLE").getName()).isEqualTo("TITLE"); + assertThat(foreignEntity.getAttributeByName("TITLE").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("TITLE").getOrdinalPosition()).isEqualTo(2); + assertThat(foreignEntity.getAttributeByName("TITLE").getBelongingEntity().getName()).isEqualTo("FOREIGN_PROJECT"); + + assertThat(foreignEntity.getAttributeByName("PROJECT_MANAGER")).isNotNull(); + assertThat(foreignEntity.getAttributeByName("PROJECT_MANAGER").getName()).isEqualTo("PROJECT_MANAGER"); + assertThat(foreignEntity.getAttributeByName("PROJECT_MANAGER").getDataType()).isEqualTo("VARCHAR"); + assertThat(foreignEntity.getAttributeByName("PROJECT_MANAGER").getOrdinalPosition()).isEqualTo(3); + assertThat(foreignEntity.getAttributeByName("PROJECT_MANAGER").getBelongingEntity().getName()).isEqualTo("FOREIGN_PROJECT"); // relationship, primary and foreign key check - assertEquals(1, foreignEntity.getOutCanonicalRelationships().size()); - assertEquals(1, parentEntity.getOutCanonicalRelationships().size()); - assertEquals(0, foreignEntity.getInCanonicalRelationships().size()); - assertEquals(2, parentEntity.getInCanonicalRelationships().size()); - assertEquals(1, parentEntity.getForeignKeys().size()); - assertEquals(1, foreignEntity.getForeignKeys().size()); + assertThat(foreignEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(parentEntity.getOutCanonicalRelationships().size()).isEqualTo(1); + assertThat(foreignEntity.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(parentEntity.getInCanonicalRelationships().size()).isEqualTo(2); + assertThat(parentEntity.getForeignKeys().size()).isEqualTo(1); + assertThat(foreignEntity.getForeignKeys().size()).isEqualTo(1); // first relationship Iterator it = foreignEntity.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("PARENT_EMPLOYEE", currentRelationship.getParentEntity().getName()); - assertEquals("FOREIGN_PROJECT", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(foreignEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FOREIGN_PROJECT"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(foreignEntity.getForeignKeys().get(0)); Iterator it2 = parentEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("PROJECT_MANAGER", foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("EMP_ID", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(foreignEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("PROJECT_MANAGER"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EMP_ID"); // second relationship it = parentEntity.getOutCanonicalRelationships().iterator(); currentRelationship = it.next(); - assertEquals("PARENT_EMPLOYEE", currentRelationship.getParentEntity().getName()); - assertEquals("PARENT_EMPLOYEE", currentRelationship.getForeignEntity().getName()); - assertEquals(parentEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(parentEntity.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("PARENT_EMPLOYEE"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(parentEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(parentEntity.getForeignKeys().get(0)); currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("MGR_ID", parentEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("EMP_ID", parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(parentEntity.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("MGR_ID"); + assertThat(parentEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("EMP_ID"); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -795,17 +793,17 @@ public void buildSourceSchemaFromTwoTablesWithOneSimplePKImportedTwice() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } - @Test /* * Join table and 2 parent tables. */ - public void buildSourceSchemaFromJoinTableAnd2ParentTables() { + @Test + void buildSourceSchemaFromJoinTableAnd2ParentTables() { Connection connection = null; Statement st = null; @@ -840,10 +838,10 @@ public void buildSourceSchemaFromJoinTableAnd2ParentTables() { * Testing context information */ - assertEquals(3, statistics.totalNumberOfEntities); - assertEquals(3, statistics.builtEntities); - assertEquals(2, statistics.totalNumberOfRelationships); - assertEquals(2, statistics.builtRelationships); + assertThat(statistics.totalNumberOfEntities).isEqualTo(3); + assertThat(statistics.builtEntities).isEqualTo(3); + assertThat(statistics.totalNumberOfRelationships).isEqualTo(2); + assertThat(statistics.builtRelationships).isEqualTo(2); /* * Testing built source db schema @@ -854,61 +852,61 @@ public void buildSourceSchemaFromJoinTableAnd2ParentTables() { Entity film2actor = mapper.getDataBaseSchema().getEntityByName("FILM2ACTOR"); // entities check - assertEquals(3, mapper.getDataBaseSchema().getEntities().size()); - assertEquals(2, mapper.getDataBaseSchema().getCanonicalRelationships().size()); - assertNotNull(filmEntity); - assertNotNull(actorEntity); - assertNotNull(film2actor); + assertThat(mapper.getDataBaseSchema().getEntities().size()).isEqualTo(3); + assertThat(mapper.getDataBaseSchema().getCanonicalRelationships().size()).isEqualTo(2); + assertThat(filmEntity).isNotNull(); + assertThat(actorEntity).isNotNull(); + assertThat(film2actor).isNotNull(); // attributes check - assertEquals(4, filmEntity.getAttributes().size()); - assertEquals(3, actorEntity.getAttributes().size()); - assertEquals(3, film2actor.getAttributes().size()); + assertThat(filmEntity.getAttributes().size()).isEqualTo(4); + assertThat(actorEntity.getAttributes().size()).isEqualTo(3); + assertThat(film2actor.getAttributes().size()).isEqualTo(3); // relationship, primary and foreign key check - assertEquals(0, filmEntity.getOutCanonicalRelationships().size()); - assertEquals(0, actorEntity.getOutCanonicalRelationships().size()); - assertEquals(2, film2actor.getOutCanonicalRelationships().size()); - assertEquals(1, filmEntity.getInCanonicalRelationships().size()); - assertEquals(1, actorEntity.getInCanonicalRelationships().size()); - assertEquals(0, film2actor.getInCanonicalRelationships().size()); - assertEquals(0, filmEntity.getForeignKeys().size()); - assertEquals(0, actorEntity.getForeignKeys().size()); - assertEquals(2, film2actor.getForeignKeys().size()); + assertThat(filmEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(actorEntity.getOutCanonicalRelationships().size()).isEqualTo(0); + assertThat(film2actor.getOutCanonicalRelationships().size()).isEqualTo(2); + assertThat(filmEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(actorEntity.getInCanonicalRelationships().size()).isEqualTo(1); + assertThat(film2actor.getInCanonicalRelationships().size()).isEqualTo(0); + assertThat(filmEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(actorEntity.getForeignKeys().size()).isEqualTo(0); + assertThat(film2actor.getForeignKeys().size()).isEqualTo(2); // first relationship Iterator it = film2actor.getOutCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship = it.next(); - assertEquals("ACTOR", currentRelationship.getParentEntity().getName()); - assertEquals("FILM2ACTOR", currentRelationship.getForeignEntity().getName()); - assertEquals(actorEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(film2actor.getForeignKeys().get(0), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("ACTOR"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FILM2ACTOR"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(actorEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(film2actor.getForeignKeys().get(0)); Iterator it2 = actorEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship2 = it2.next(); - assertEquals(currentRelationship, currentRelationship2); + assertThat(currentRelationship2).isEqualTo(currentRelationship); - assertEquals("ACTOR_ID", film2actor.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()); - assertEquals("ID", actorEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(film2actor.getForeignKeys().get(0).getInvolvedAttributes().get(0).getName()).isEqualTo("ACTOR_ID"); + assertThat(actorEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); // second relationship currentRelationship = it.next(); - assertEquals("FILM", currentRelationship.getParentEntity().getName()); - assertEquals("FILM2ACTOR", currentRelationship.getForeignEntity().getName()); - assertEquals(filmEntity.getPrimaryKey(), currentRelationship.getPrimaryKey()); - assertEquals(film2actor.getForeignKeys().get(1), currentRelationship.getForeignKey()); + assertThat(currentRelationship.getParentEntity().getName()).isEqualTo("FILM"); + assertThat(currentRelationship.getForeignEntity().getName()).isEqualTo("FILM2ACTOR"); + assertThat(currentRelationship.getPrimaryKey()).isEqualTo(filmEntity.getPrimaryKey()); + assertThat(currentRelationship.getForeignKey()).isEqualTo(film2actor.getForeignKeys().get(1)); Iterator it3 = filmEntity.getInCanonicalRelationships().iterator(); CanonicalRelationship currentRelationship3 = it3.next(); - assertEquals(currentRelationship, currentRelationship3); + assertThat(currentRelationship3).isEqualTo(currentRelationship); - assertEquals("FILM_ID", film2actor.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()); - assertEquals("ID", filmEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()); + assertThat(film2actor.getForeignKeys().get(1).getInvolvedAttributes().get(0).getName()).isEqualTo("FILM_ID"); + assertThat(filmEntity.getPrimaryKey().getInvolvedAttributes().get(0).getName()).isEqualTo("ID"); - assertFalse(it.hasNext()); + assertThat(it.hasNext()).isFalse(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } finally { try { // Dropping Source DB Schema and OrientGraph @@ -917,7 +915,7 @@ public void buildSourceSchemaFromJoinTableAnd2ParentTables() { connection.close(); } catch (Exception e) { e.printStackTrace(); - fail(); + fail(""); } } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/JavaNameResolverTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/JavaNameResolverTest.java index d904a35c..957e47f5 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/JavaNameResolverTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/JavaNameResolverTest.java @@ -40,7 +40,7 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import com.arcadeanalytics.provider.rdbms.nameresolver.JavaConventionNameResolver; import org.junit.jupiter.api.BeforeEach; @@ -50,237 +50,237 @@ * @author Gabriele Ponzi */ -public class JavaNameResolverTest { +class JavaNameResolverTest { private JavaConventionNameResolver nameResolver; @BeforeEach - public void init() { + void init() { this.nameResolver = new JavaConventionNameResolver(); } - @Test /* * Resolve Vertex Class Name (Java Class Convention) */ - public void resolveVertexClassNameWithJavaConvention() { + @Test + void resolveVertexClassNameWithJavaConvention() { String candidateName = ""; String newCandidateName = ""; // No white space nor underscore candidateName = "testClass"; // NOT acceptable (one or more uppercase char, except the first one) - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "Testclass"; // acceptable (one or more uppercase char, the first one included) - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isTrue(); candidateName = "TestClass"; // acceptable (one or more uppercase char, except the first one) - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isTrue(); candidateName = "testclass"; // NOT acceptable (no uppercase chars) - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("Testclass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("Testclass"); candidateName = "TESTCLASS"; // NOT acceptable (no lowercase chars) - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("Testclass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("Testclass"); // White space candidateName = "test Class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "Test class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "Test Class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "test class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "TEST CLASS"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); // Underscore candidateName = "test_Class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "Test_class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "Test_Class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "test_class"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "TEST_CLASS"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); } - @Test /* * Resolve Vertex Class Name (Java Class Convention) * Test-Fix: Resolver supports names ending with '_'. */ - public void resolveVertexClassNameWithJavaConventionNamesEndingWithUnderscore() { + @Test + void resolveVertexClassNameWithJavaConventionNamesEndingWithUnderscore() { String candidateName = ""; String newCandidateName = ""; // No white space nor underscore candidateName = "testClass_"; // NOT acceptable (one or more uppercase char, except the first one) - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.toJavaClassConvention(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "test_class_"; // NOT acceptable (one or more uppercase char, except the first one) - assertEquals(false, nameResolver.isCompliantToJavaClassConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaClassConvention(candidateName)).isFalse(); newCandidateName = nameResolver.toJavaClassConvention(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaClassConvention(newCandidateName)); - assertEquals("TestClass", newCandidateName); + assertThat(nameResolver.isCompliantToJavaClassConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("TestClass"); } - @Test /* * Resolve Vertex Property (Java Variable Convention) */ - public void resolveVertexPropertyNameWithJavaConvention() { + @Test + void resolveVertexPropertyNameWithJavaConvention() { String candidateName = ""; String newCandidateName = ""; // No white space nor underscore candidateName = "testVariable"; // acceptable (one or more uppercase char, except the first one) - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isTrue(); candidateName = "Testvariable"; // NOT acceptable (one or more uppercase char, the first one included) - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testvariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testvariable"); candidateName = "TestVariable"; // NOT acceptable (one or more uppercase char, except the first one) - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "testvariable"; // acceptable (no uppercase chars) - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isTrue(); candidateName = "TESTVARIABLE"; // NOT acceptable (no lowercase chars) - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testvariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testvariable"); // White space candidateName = "test Variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "Test variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "Test Variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "test variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "TEST VARIABLE"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); // Underscore candidateName = "test_Variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "Test_variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "Test_Variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "test_variable"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "TEST_VARIABLE"; // NOT acceptable - assertEquals(false, nameResolver.isCompliantToJavaVariableConvention(candidateName)); + assertThat(nameResolver.isCompliantToJavaVariableConvention(candidateName)).isFalse(); newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals(true, nameResolver.isCompliantToJavaVariableConvention(newCandidateName)); - assertEquals("testVariable", newCandidateName); + assertThat(nameResolver.isCompliantToJavaVariableConvention(newCandidateName)).isTrue(); + assertThat(newCandidateName).isEqualTo("testVariable"); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/OriginalNameResolverTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/OriginalNameResolverTest.java index 38734525..028abdcb 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/OriginalNameResolverTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/resolver/OriginalNameResolverTest.java @@ -40,7 +40,7 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import com.arcadeanalytics.provider.rdbms.nameresolver.OriginalConventionNameResolver; import org.junit.jupiter.api.BeforeEach; @@ -50,21 +50,21 @@ * @author Gabriele Ponzi */ -public class OriginalNameResolverTest { +class OriginalNameResolverTest { private OriginalConventionNameResolver nameResolver; @BeforeEach - public void init() { + void init() { this.nameResolver = new OriginalConventionNameResolver(); } - @Test /* * Resolve Vertex Class Name (Original Class Convention) */ - public void resolveVertexClassNameWithOriginalNameConvention() { + @Test + void resolveVertexClassNameWithOriginalNameConvention() { String candidateName = ""; String newCandidateName = ""; @@ -72,75 +72,75 @@ public void resolveVertexClassNameWithOriginalNameConvention() { candidateName = "testClass"; // NOT acceptable (one or more uppercase char, except the first one) newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("testClass", newCandidateName); + assertThat(newCandidateName).isEqualTo("testClass"); candidateName = "Testclass"; // acceptable (one or more uppercase char, the first one included) newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("Testclass", newCandidateName); + assertThat(newCandidateName).isEqualTo("Testclass"); candidateName = "TestClass"; // acceptable (one or more uppercase char, except the first one) newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("TestClass", newCandidateName); + assertThat(newCandidateName).isEqualTo("TestClass"); candidateName = "testclass"; // NOT acceptable (no uppercase chars) newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("testclass", newCandidateName); + assertThat(newCandidateName).isEqualTo("testclass"); candidateName = "TESTCLASS"; // NOT acceptable (no lowercase chars) newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("TESTCLASS", newCandidateName); + assertThat(newCandidateName).isEqualTo("TESTCLASS"); // White space candidateName = "test Class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("test_Class", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_Class"); candidateName = "Test class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("Test_class", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_class"); candidateName = "Test Class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("Test_Class", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_Class"); candidateName = "test class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("test_class", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_class"); candidateName = "TEST CLASS"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("TEST_CLASS", newCandidateName); + assertThat(newCandidateName).isEqualTo("TEST_CLASS"); // Underscore candidateName = "test_Class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("test_Class", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_Class"); candidateName = "Test_class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("Test_class", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_class"); candidateName = "Test_Class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("Test_Class", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_Class"); candidateName = "test_class"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("test_class", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_class"); candidateName = "TEST_CLASS"; // NOT acceptable newCandidateName = nameResolver.resolveVertexName(candidateName); - assertEquals("TEST_CLASS", newCandidateName); + assertThat(newCandidateName).isEqualTo("TEST_CLASS"); } - @Test /* * Resolve Vertex Property (Original Variable Convention) */ - public void resolveVertexPropertyNameWithOriginalNameConvention() { + @Test + void resolveVertexPropertyNameWithOriginalNameConvention() { String candidateName = ""; String newCandidateName = ""; @@ -148,66 +148,66 @@ public void resolveVertexPropertyNameWithOriginalNameConvention() { candidateName = "testVariable"; // acceptable (one or more uppercase char, except the first one) newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("testVariable", newCandidateName); + assertThat(newCandidateName).isEqualTo("testVariable"); candidateName = "Testvariable"; // NOT acceptable (one or more uppercase char, the first one included) newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("Testvariable", newCandidateName); + assertThat(newCandidateName).isEqualTo("Testvariable"); candidateName = "TestVariable"; // NOT acceptable (one or more uppercase char, except the first one) newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("TestVariable", newCandidateName); + assertThat(newCandidateName).isEqualTo("TestVariable"); candidateName = "testvariable"; // acceptable (no uppercase chars) newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("testvariable", newCandidateName); + assertThat(newCandidateName).isEqualTo("testvariable"); candidateName = "TESTVARIABLE"; // NOT acceptable (no lowercase chars) newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("TESTVARIABLE", newCandidateName); + assertThat(newCandidateName).isEqualTo("TESTVARIABLE"); // White space candidateName = "test Variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("test_Variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_Variable"); candidateName = "Test variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("Test_variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_variable"); candidateName = "Test Variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("Test_Variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_Variable"); candidateName = "test variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("test_variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_variable"); candidateName = "TEST VARIABLE"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("TEST_VARIABLE", newCandidateName); + assertThat(newCandidateName).isEqualTo("TEST_VARIABLE"); // Underscore candidateName = "test_Variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("test_Variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_Variable"); candidateName = "Test_variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("Test_variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_variable"); candidateName = "Test_Variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("Test_Variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("Test_Variable"); candidateName = "test_variable"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("test_variable", newCandidateName); + assertThat(newCandidateName).isEqualTo("test_variable"); candidateName = "TEST_VARIABLE"; // NOT acceptable newCandidateName = nameResolver.resolveVertexProperty(candidateName); - assertEquals("TEST_VARIABLE", newCandidateName); + assertThat(newCandidateName).isEqualTo("TEST_VARIABLE"); } } diff --git a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/util/FunctionsHandlerTest.java b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/util/FunctionsHandlerTest.java index 073af3fd..cca3ae9d 100644 --- a/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/util/FunctionsHandlerTest.java +++ b/rdbms/src/test/java/com/arcadeanalytics/provider/rdbms/util/FunctionsHandlerTest.java @@ -40,8 +40,7 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; import com.orientechnologies.orient.core.record.impl.ODocument; import java.util.Date; @@ -51,23 +50,23 @@ * @author Gabriele Ponzi */ -public class FunctionsHandlerTest { +class FunctionsHandlerTest { @Test - public void timeFormatsTest() { + void timeFormatsTest() { Date start = new Date(); long endMillis = start.getTime() + 7713000L; Date end = new Date(endMillis); String timeFormat1 = FunctionsHandler.getHMSFormat(start, end); - assertEquals("02:08:33", timeFormat1); + assertThat(timeFormat1).isEqualTo("02:08:33"); String timeFormat2 = FunctionsHandler.getHMSFormat(7713000L); - assertEquals("02:08:33", timeFormat2); + assertThat(timeFormat2).isEqualTo("02:08:33"); } @Test - public void documentEqualsTest() { + void documentEqualsTest() { // two identical documents String stringDoc1 = @@ -106,7 +105,7 @@ public void documentEqualsTest() { ODocument document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == true); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(true); // two documents with the same content (fields' order not equal) @@ -128,7 +127,7 @@ public void documentEqualsTest() { document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == true); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(true); // two documents with different content (different values) @@ -150,7 +149,7 @@ public void documentEqualsTest() { document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == false); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(false); // two documents with different content (different number of fields) @@ -170,7 +169,7 @@ public void documentEqualsTest() { document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == false); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(false); // two documents with different content (different fields' name) @@ -192,7 +191,7 @@ public void documentEqualsTest() { document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == false); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(false); // two documents with different content (at least one field in doc1 is a nested document while the correspondent field in doc2 is a string) @@ -210,6 +209,6 @@ public void documentEqualsTest() { document2 = new ODocument(); document2.fromJSON(stringDoc2, "noMap"); - assertTrue(FunctionsHandler.haveDocumentsSameContent(document1, document2) == false); + assertThat(FunctionsHandler.haveDocumentsSameContent(document1, document2)).isEqualTo(false); } } diff --git a/rdbms/src/test/kotlin/com/arcadeanalytics/provider/rdbms/PostgreSQLMetadataProviderTest.kt b/rdbms/src/test/kotlin/com/arcadeanalytics/provider/rdbms/PostgreSQLMetadataProviderTest.kt index ffb9e5b3..5fbbdf4e 100644 --- a/rdbms/src/test/kotlin/com/arcadeanalytics/provider/rdbms/PostgreSQLMetadataProviderTest.kt +++ b/rdbms/src/test/kotlin/com/arcadeanalytics/provider/rdbms/PostgreSQLMetadataProviderTest.kt @@ -23,7 +23,7 @@ import com.arcadeanalytics.provider.DataSourceInfo import com.arcadeanalytics.provider.rdbms.dataprovider.PostgreSQLContainerHolder import org.assertj.core.api.Assertions import org.assertj.core.api.Assertions.assertThat -import org.junit.Assert +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance @@ -31,7 +31,6 @@ import org.testcontainers.containers.PostgreSQLContainer @TestInstance(TestInstance.Lifecycle.PER_CLASS) class PostgreSQLMetadataProviderTest { - private val container: PostgreSQLContainer = PostgreSQLContainerHolder.container as PostgreSQLContainer private lateinit var providerNoAggregation: RDBMSMetadataProvider @@ -43,28 +42,30 @@ class PostgreSQLMetadataProviderTest { @BeforeEach @Throws(Exception::class) fun setUp() { - dataSourceNoAggregation = DataSourceInfo( - id = 1L, - type = "RDBMS_POSTGRESQL", - name = "testDataSource", - server = container.containerIpAddress, - port = container.firstMappedPort, - username = container.username, - password = container.password, - database = container.databaseName, - aggregationEnabled = false, - ) - dataSourceWithAggregation = DataSourceInfo( - id = 1L, - type = "RDBMS_POSTGRESQL", - name = "testDataSource", - server = container.containerIpAddress, - port = container.firstMappedPort, - username = container.username, - password = container.password, - database = container.databaseName, - aggregationEnabled = true, - ) + dataSourceNoAggregation = + DataSourceInfo( + id = 1L, + type = "RDBMS_POSTGRESQL", + name = "testDataSource", + server = container.containerIpAddress, + port = container.firstMappedPort, + username = container.username, + password = container.password, + database = container.databaseName, + aggregationEnabled = false, + ) + dataSourceWithAggregation = + DataSourceInfo( + id = 1L, + type = "RDBMS_POSTGRESQL", + name = "testDataSource", + server = container.containerIpAddress, + port = container.firstMappedPort, + username = container.username, + password = container.password, + database = container.databaseName, + aggregationEnabled = true, + ) providerNoAggregation = RDBMSMetadataProvider() providerWithAggregation = RDBMSMetadataProvider() @@ -74,7 +75,8 @@ class PostgreSQLMetadataProviderTest { fun shouldFetchMetadata() { val metadata = providerNoAggregation.fetchMetadata(dataSourceNoAggregation) - assertThat(metadata.nodesClasses).isNotEmpty + assertThat(metadata.nodesClasses) + .isNotEmpty .containsKeys("actor", "address", "category", "city", "country", "customer", "film", "rental", "payment", "language") assertThat(metadata.edgesClasses).isNotEmpty @@ -91,146 +93,146 @@ class PostgreSQLMetadataProviderTest { val nodesClasses = metadata.nodesClasses val edgesClasses = metadata.edgesClasses - Assert.assertEquals(15, nodesClasses.size) - Assert.assertEquals(12, edgesClasses.size) + assertThat(nodesClasses.size).isEqualTo(15) + assertThat(edgesClasses.size).isEqualTo(12) /* * Vertices Classes check */ var currVertexClassName = "actor" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(200, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(200) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "address" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(8, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(8) } currVertexClassName = "category" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(16, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "city" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(600, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(600) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "country" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(109, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(109) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "customer" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(599, currVertexClassInfo.cardinality) - Assert.assertEquals(10, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(599) + assertThat(currVertexClassInfo.properties.size).isEqualTo(10) } currVertexClassName = "film" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(13, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(13) } currVertexClassName = "film_actor" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(5462, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(5462) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "film_category" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "inventory" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(4581, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(4581) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "language" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(6, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(6) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "payment" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(14596, currVertexClassInfo.cardinality) - Assert.assertEquals(6, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(14596) + assertThat(currVertexClassInfo.properties.size).isEqualTo(6) } currVertexClassName = "rental" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(16044, currVertexClassInfo.cardinality) - Assert.assertEquals(7, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16044) + assertThat(currVertexClassInfo.properties.size).isEqualTo(7) } currVertexClassName = "staff" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(11, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(11) } currVertexClassName = "store" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } /* @@ -238,111 +240,111 @@ class PostgreSQLMetadataProviderTest { */ var currEdgeClassName = "has_actor" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(5462, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(5462) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_address" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_category" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_city" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_country" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(600, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(600) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_customer" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(30640, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(30640) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_film" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(11043, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(11043) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_inventory" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(16044, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16044) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_language" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_manager_staff" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_rental" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(14596, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(14596) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_staff" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(30640, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(30640) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } } @@ -357,128 +359,128 @@ class PostgreSQLMetadataProviderTest { val nodesClasses = metadata.nodesClasses val edgesClasses = metadata.edgesClasses - Assert.assertEquals(13, nodesClasses.size) - Assert.assertEquals(12, edgesClasses.size) + assertThat(nodesClasses.size).isEqualTo(13) + assertThat(edgesClasses.size).isEqualTo(12) /* * Vertices Classes check */ var currVertexClassName = "actor" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(200, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(200) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "address" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(8, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(8) } currVertexClassName = "category" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(16, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "city" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(600, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(600) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "country" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(109, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(109) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "customer" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(599, currVertexClassInfo.cardinality) - Assert.assertEquals(10, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(599) + assertThat(currVertexClassInfo.properties.size).isEqualTo(10) } currVertexClassName = "film" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(13, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(13) } currVertexClassName = "inventory" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(4581, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(4581) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } currVertexClassName = "language" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(6, currVertexClassInfo.cardinality) - Assert.assertEquals(3, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(6) + assertThat(currVertexClassInfo.properties.size).isEqualTo(3) } currVertexClassName = "payment" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(14596, currVertexClassInfo.cardinality) - Assert.assertEquals(6, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(14596) + assertThat(currVertexClassInfo.properties.size).isEqualTo(6) } currVertexClassName = "rental" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(16044, currVertexClassInfo.cardinality) - Assert.assertEquals(7, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16044) + assertThat(currVertexClassInfo.properties.size).isEqualTo(7) } currVertexClassName = "staff" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(11, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(11) } currVertexClassName = "store" - Assert.assertTrue(nodesClasses.keys.contains(currVertexClassName)) - Assert.assertNotNull(nodesClasses.get(currVertexClassName)) + assertTrue(nodesClasses.keys.contains(currVertexClassName)) + assertThat(nodesClasses.get(currVertexClassName)).isNotNull() nodesClasses.get(currVertexClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currVertexClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(4, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currVertexClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(4) } /* @@ -486,111 +488,111 @@ class PostgreSQLMetadataProviderTest { */ var currEdgeClassName = "film_actor" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(5462, currVertexClassInfo.cardinality) - Assert.assertEquals(1, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(5462) + assertThat(currVertexClassInfo.properties.size).isEqualTo(1) } currEdgeClassName = "film_category" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(1, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(1) } currEdgeClassName = "has_address" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_city" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(603, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(603) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_country" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(600, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(600) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_customer" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(30640, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(30640) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_film" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(4581, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(4581) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_inventory" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(16044, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(16044) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_language" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(1000, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(1000) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_manager_staff" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(2, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(2) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_rental" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(14596, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(14596) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } currEdgeClassName = "has_staff" - Assert.assertTrue(edgesClasses.keys.contains(currEdgeClassName)) - Assert.assertNotNull(edgesClasses.get(currEdgeClassName)) + assertTrue(edgesClasses.keys.contains(currEdgeClassName)) + assertThat(edgesClasses.get(currEdgeClassName)).isNotNull() edgesClasses.get(currEdgeClassName)?.let { currVertexClassInfo -> - Assert.assertEquals(currEdgeClassName, currVertexClassInfo.name) - Assert.assertEquals(30640, currVertexClassInfo.cardinality) - Assert.assertEquals(0, currVertexClassInfo.properties.size) + assertThat(currVertexClassInfo.name).isEqualTo(currEdgeClassName) + assertThat(currVertexClassInfo.cardinality).isEqualTo(30640) + assertThat(currVertexClassInfo.properties.size).isEqualTo(0) } } }